Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-failing-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
michalinacienciala committed Jul 24, 2023
2 parents f5c4411 + 15458c3 commit 414e260
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 58 deletions.
24 changes: 3 additions & 21 deletions background/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,30 +508,12 @@ export default class Main extends BaseService<never> {
// Start up the redux store and set it up for proxying.
this.store = initializeStore(savedReduxState, this)

const queueUpdate = debounce(
(lastState, newState, updateFn) => {
if (lastState === newState) {
return
}

const diff = deepDiff(lastState, newState)

if (diff !== undefined) {
updateFn(newState, [diff])
}
},
30,
{ maxWait: 30, trailing: true }
)

wrapStore(this.store, {
serializer: encodeJSON,
deserializer: decodeJSON,
diffStrategy: (oldObj, newObj, forceUpdate) => {
queueUpdate(oldObj, newObj, forceUpdate)

// Return no diffs as we're manually handling these inside `queueUpdate`
return []
diffStrategy: (oldObj, newObj) => {
const diffWrapper = deepDiff(oldObj, newObj)
return diffWrapper === undefined ? [] : [diffWrapper]
},
dispatchResponder: async (
dispatchResult: Promise<unknown>,
Expand Down
Loading

0 comments on commit 414e260

Please sign in to comment.