Skip to content

saveStatus showing unsaved when status should be saved #12

Open
@sfisher4

Description

@sfisher4

Thanks for this great resource!

While I was using the useReactQueryAutoSync hook in my project, I noticed the saveStatus conditional returns unsaved when draft is really saved. I also noticed this wasn't working in the demo.

In useReactQueryAutoSync, onMutation in the useMutation hook will set the draft to undefined setDraft(undefined); after it is mutated. This results in the saveStatus value to equal 'unsaved' when it is really saved. Am I using this setStatus states correctly? If so, a suggestion is to add an or statement to saveStatus. ie for the last conditional:

queryResult.data === draft || draft === undefined ? 'saved' : 'unsaved'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions