Skip to content

[Bug]: RouterModule.forRoot() is imported twice when loading a story #25726

Open
@jiacoucci-extron

Description

@jiacoucci-extron

Describe the bug

When importing the RouterModule and using the forRoot() pattern for routing storybook seems to import this twice causing NG04007: The Router was provided more than once.

You can see this in the screenshot below:
image

I see this error in:
storybook 7.4.3 Angular 15
storybook 7.5 Angular 16.
I even upgraded to 7.6.10 with Angular 15 and still had the same issue.

I do not have this error in storybook 7.4.3 Angular 14.

To Reproduce

Stackblitz: https://stackblitz.com/edit/github-vrpkro-pu8ckn?file=src%2Fstories%2FPage.stories.ts

Code change on line 22 in Page.Stories.ts
Reproduction:

  1. Load project
  2. Navigate to page example
  3. The error will appear in place of story

You can navigate to the other examples and see that without the RouterModule.forRoot() imported you will not have the same issue.

System

Local project: 7.4.3
StackBlitz: 7.5.0-alpha
chrome: Version 120.0.6099.234

Additional context

I found a similar issue that has been resolved here: #21284

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