Redux Optimistic update

hey guys i am making a desktop app with electron, i wanna ask regarding how u keep the states synced between sqlite and redux ( or any state management lib ) rn what i m doing is doing optimistic updates on (optimistic update bts put it in the queue)
dispatch(addOptimisticWorkspace({workspace:newWorkspac})
dispatch(createWorkspace(newWorkspace))
dispatch(addOptimisticWorkspace({workspace:newWorkspac})
dispatch(createWorkspace(newWorkspace))
first one adds it to redux and 2nd one uses thunk to call ipc to create workspace, if success remove optmistic one and add return value and remove it from queue if its there else it gets it from the queue and retry after 5 sec along with others if any ) but lets say something happen and it got saved in sqlite but not in got updated in redux then how should i manage the data incosistancy between them one thing i can do is force sync manually by cleaning redux and fetch all the data, but i dont like this apporch
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?