Adds Redux and React-Intl to storybook (#35094)

This commit is contained in:
Echo 2025-06-24 11:31:27 +02:00 committed by GitHub
commit 8ee8231a43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 876 additions and 53 deletions

View file

@ -1,4 +1,4 @@
import { Record as ImmutableRecord } from 'immutable';
import { Record as ImmutableRecord, mergeDeep } from 'immutable';
import { loadingBarReducer } from 'react-redux-loading-bar';
import { combineReducers } from 'redux-immutable';
@ -98,6 +98,15 @@ const initialRootState = Object.fromEntries(
const RootStateRecord = ImmutableRecord(initialRootState, 'RootState');
const rootReducer = combineReducers(reducers, RootStateRecord);
export const rootReducer = combineReducers(reducers, RootStateRecord);
export { rootReducer };
export function reducerWithInitialState(
stateOverrides: Record<string, unknown> = {},
) {
const initialStateRecord = mergeDeep(initialRootState, stateOverrides);
const PatchedRootStateRecord = ImmutableRecord(
initialStateRecord,
'RootState',
);
return combineReducers(reducers, PatchedRootStateRecord);
}