diff --git a/packages/headless/src/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.ts b/packages/headless/src/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.ts index 016e6ff4d3c..5fa72c783a7 100644 --- a/packages/headless/src/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.ts +++ b/packages/headless/src/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.ts @@ -15,7 +15,7 @@ export interface ParameterManagerProps { /** * The initial state that should be applied to the `ParameterManager` sub-controller. */ - initialState: ParameterManagerInitialState; + initialState?: ParameterManagerInitialState; } export interface CoreParameterManagerProps @@ -116,13 +116,15 @@ export function buildCoreParameterManager( const {dispatch} = engine; const controller = buildController(engine); - validateInitialState( - engine, - initialStateSchema(props.parametersDefinition), - props.initialState, - 'buildCoreParameterManager' - ); - dispatch(props.restoreActionCreator(props.initialState.parameters)); + if (props.initialState) { + validateInitialState( + engine, + initialStateSchema(props.parametersDefinition), + props.initialState, + 'buildCoreParameterManager' + ); + dispatch(props.restoreActionCreator(props.initialState?.parameters)); + } return { ...controller,