Skip to content

Commit

Permalink
feat: Add the possibility to specify action types to invoke the reduc…
Browse files Browse the repository at this point in the history
…er in the storage sync helper
  • Loading branch information
Abhishek Buragohain committed Feb 21, 2024
1 parent f703128 commit 6f91a4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@o3r/store-sync/src/sync-storage/storage-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { deepFill } from '@o3r/core';
import type { Logger } from '@o3r/core';
import type { StorageKeyConfiguration, StorageKeys, SyncStorageConfig, SyncStorageSyncOptions } from './interfaces';

/** The recompute action type of ngrx store devtools */
const RECOMPUTE = '@ngrx/store-devtools/recompute';

/**
* Reviver the date from a JSON field if the string is matching iso format. Return the same value otherwise
*
Expand Down Expand Up @@ -328,7 +331,7 @@ export const syncStorage = (config: SyncStorageConfig) => (reducer: any) => {

// If state arrives undefined, we need to let it through the supplied reducer
// in order to get a complete state as defined by user
if (action.type === INIT && !state) {
if ((action.type === INIT || action.type === UPDATE || action.type === RECOMPUTE) && !state) {
nextState = reducer(state, action);
} else {
nextState = { ...state };
Expand Down

0 comments on commit 6f91a4c

Please sign in to comment.