Skip to content

Commit

Permalink
Add SetTimeout to send the update after the reset
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Oct 3, 2023
1 parent 46102b4 commit 9f0e48f
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ export const createOrUpdateRegulation = (processingRegulation, id, previousId) =
* /!\ This constraint is only applied to the local (CROSS) regulations table.
*/
await dispatch(resetPreviousRegulation(previousId, id))

/**
* We must wait for the reset to be done.
* TODO Add the two UPDATE into the same transaction to remove this `setTimeout`
*/
setTimeout(() => {
/**
* Then, we update the new regulation with the values of the previous one
*/
dispatch(updateRegulation(feature, REGULATION_ACTION_TYPE.UPDATE))
}, 1000)

return
}

/**
Expand Down

0 comments on commit 9f0e48f

Please sign in to comment.