Skip to content

[Bug]: Angular APP_INITIALIZER not firing at Storybook 8 #29386

Open
@gogumachu

Description

@gogumachu

Describe the bug

When using storybook 8 version in angular, the APP_INITIALZER dosen't work.

The problem looks the same as the issue before.

I tried to correct it by referring to what was on this link, but it still doesn't run.

I modified 'preview.ts' as below in this stackblitz project, but it doesn't work.

const preview: Preview = {
  parameters: {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/i,
      },
    },
  },
  decorators: [
    moduleMetadata({
      providers: [
        {
          provide: APP_INITIALIZER,
          useFactory: () => {
            console.log('APP_INITIALIZER!!!!');
          },
          multi: true,
        },
      ],
    }),
  ],
};

export default preview;

Reproduction link

https://stackblitz.com/edit/github-rkffss-81zfge

Reproduction steps

  1. Go here https://stackblitz.com/edit/github-rkffss-81zfge
  2. and modify preview.ts
const preview: Preview = {
  parameters: {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/i,
      },
    },
  },
  decorators: [
    moduleMetadata({
      providers: [
        {
          provide: APP_INITIALIZER,
          useFactory: () => {
            console.log('APP_INITIALIZER!!!!');
          },
          multi: true,
        },
      ],
    }),
  ],
};

export default preview;
  1. I can't see the APP_INITIALIZER!!!! log

System

[email protected]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions