Skip to content

Commit

Permalink
fix issue on store
Browse files Browse the repository at this point in the history
  • Loading branch information
zenoxs committed Jul 20, 2022
1 parent 628ceb1 commit 9712e75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/renderer/src/store/root-store/setup-root-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ export async function setupRootStore() {
const patchesFromMain: Array<string> = []

window.window.lindoAPI.subscribeToIPCPatch((patch: IJsonPatch) => {
window.lindoAPI.logger.debug({ patch })()
console.debug({ patch })
patchesFromMain.push(hash(patch))
applyPatch(rootStore, patch)
})

onPatch(rootStore, (patch) => {
window.lindoAPI.logger.info('onPatch', patch)()
console.info('onPatch', patch)
// ignore local storage patches
if (patch.path.startsWith('/gameStore')) {
return
}

const patchHash = hash(patch)
if (patchesFromMain.includes(patchHash)) {
window.lindoAPI.logger.info('patch already applied ', patchHash)()
console.info('patch already applied ', patchHash)
patchesFromMain.splice(patchesFromMain.indexOf(patchHash), 1)
return
}
Expand Down

0 comments on commit 9712e75

Please sign in to comment.