List of notes is not always updated after updating or creating a note
CarloDiPalma opened this issue · 1 comments
CarloDiPalma commented
Sometimes(~50%) it need hard page refresh or step back to NotePage and come back to list of notes again
CarloDiPalma commented
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('/')
}