Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of notes is not always updated after updating or creating a note #6

Open
CarloDiPalma opened this issue Nov 29, 2022 · 1 comment

Comments

@CarloDiPalma
Copy link

CarloDiPalma commented Nov 29, 2022

Sometimes(~50%) it need hard page refresh or step back to NotePage and come back to list of notes again

@CarloDiPalma CarloDiPalma changed the title List of notes is not always updated after updating a note List of notes is not always updated after updating or creating a note Dec 2, 2022
@CarloDiPalma
Copy link
Author

I added async and await to handleSubmit in NotePage.js and and it looks like it fixed the problem.

let handleSubmit = async () => {
        console.log('NOTE:', note)
        if (noteId !== 'new' && note.body === '') {
            deleteNote().then(() => {console.log('deleteNote')})
        } else if (noteId !== 'new') {
            await updateNote().then(() => {console.log('updateNote')})
        } else if (noteId === 'new' && note.body !== null) {
            await createNote().then(() => {console.log('createNote')})
        }
        history.push('/')
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant