Skip to content

Commit

Permalink
Update reducer to use the updated action types
Browse files Browse the repository at this point in the history
  • Loading branch information
manzoorwanijk committed Nov 1, 2024
1 parent 68c6442 commit dbfe869
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions packages/data/src/redux-store/metadata/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,36 @@
import EquivalentKeyMap from 'equivalent-key-map';
import type { Reducer } from 'redux';

/**
* Internal dependencies
*/
import type {
startResolution,
finishResolution,
failResolution,
startResolutions,
finishResolutions,
failResolutions,
invalidateResolution,
invalidateResolutionForStore,
invalidateResolutionForStoreSelector,
} from './actions';

/**
* Internal dependencies
*/
import { selectorArgsToStateKey, onSubKey } from './utils';

type Action =
| ReturnType< typeof import('./actions').startResolution >
| ReturnType< typeof import('./actions').finishResolution >
| ReturnType< typeof import('./actions').failResolution >
| ReturnType< typeof import('./actions').startResolutions >
| ReturnType< typeof import('./actions').finishResolutions >
| ReturnType< typeof import('./actions').failResolutions >
| ReturnType< typeof import('./actions').invalidateResolution >
| ReturnType< typeof import('./actions').invalidateResolutionForStore >
| ReturnType<
typeof import('./actions').invalidateResolutionForStoreSelector
>;
| ReturnType< typeof startResolution >
| ReturnType< typeof finishResolution >
| ReturnType< typeof failResolution >
| ReturnType< typeof startResolutions >
| ReturnType< typeof finishResolutions >
| ReturnType< typeof failResolutions >
| ReturnType< typeof invalidateResolution >
| ReturnType< typeof invalidateResolutionForStore >
| ReturnType< typeof invalidateResolutionForStoreSelector >;

type StateKey = unknown[] | unknown;
export type StateValue =
Expand Down Expand Up @@ -142,8 +155,9 @@ const isResolved = ( state: Record< string, State > = {}, action: Action ) => {
case 'FAIL_RESOLUTIONS':
case 'INVALIDATE_RESOLUTION':
return subKeysIsResolved( state, action );
default:
return state;
}
return state;
};

export default isResolved;

0 comments on commit dbfe869

Please sign in to comment.