Skip to content

Commit

Permalink
Prepare for release & hander server race condition (#1573)
Browse files Browse the repository at this point in the history
* bump up version

* handle-server-race-condition

* added comment
  • Loading branch information
abelpz authored Apr 28, 2023
1 parent b3cfe08 commit ddccb35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion public/build_number
Original file line number Diff line number Diff line change
@@ -1 +1 @@
255-e6e5da8
257-de3d3b0
14 changes: 11 additions & 3 deletions src/hooks/useContentUpdateProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ export function useContentUpdateProps({isLoading: _isLoading = false, isSaving =
if(isSaving & !isLoading) {
setIsLoading(true);
}
if(!isSaving & isLoading) {
checkUpdateStatus();
setIsLoading(false);
if (!isSaving & isLoading) {
// There is a race condition with server returning
// a conflict while processing the last commit
// the setTimeout tries to make sure we don't get a false conflict
setTimeout(() => {
checkUpdateStatus().then((status) => {
if (status.conflict)
checkUpdateStatus();
});
setIsLoading(false);
},1000)
}
},[isSaving,isLoading,checkUpdateStatus])

Expand Down

0 comments on commit ddccb35

Please sign in to comment.