Skip to content
Discussion options

You must be logged in to vote

The problem with state syncing of any kind is the following:

  • first fetch finishes, you preselect one car.
  • user chooses a different car
  • background refetch happens some time, and data changes. maybe a new car was added

--> the effect or callback or whatever syncs the state runs again, and overwrites the user selection.

That's bad.

This might not be an issue because you only want the pre-selection if there is only one car (and the user can't select anything else, coincidentally), but it's still generally not a good pattern.

The idea is, and I've written about this a lot already, to keep server and client state separated:

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by antonisprovidakis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants