diff --git a/lib/client-api/src/ClientApi.ts b/lib/client-api/src/ClientApi.ts index 8c13b7cde47..2ea5dd02247 100644 --- a/lib/client-api/src/ClientApi.ts +++ b/lib/client-api/src/ClientApi.ts @@ -196,10 +196,16 @@ export class ClientApi { parameters ); if (globals) { - this.facade.projectAnnotations.globals = globals; + this.facade.projectAnnotations.globals = { + ...this.facade.projectAnnotations.globals, + ...globals, + }; } if (globalTypes) { - this.facade.projectAnnotations.globalTypes = normalizeInputTypes(globalTypes); + this.facade.projectAnnotations.globalTypes = { + ...this.facade.projectAnnotations.globalTypes, + ...normalizeInputTypes(globalTypes), + }; } }; diff --git a/lib/store/src/prepareStory.ts b/lib/store/src/prepareStory.ts index 39399a69b97..8e4c666c8f7 100644 --- a/lib/store/src/prepareStory.ts +++ b/lib/store/src/prepareStory.ts @@ -150,6 +150,7 @@ export function prepareStory( contextForEnhancers.parameters = { ...contextForEnhancers.parameters, __id: id, + globals: projectAnnotations.globals, globalTypes: projectAnnotations.globalTypes, args: contextForEnhancers.initialArgs, argTypes: contextForEnhancers.argTypes,