Fix Angular bug where forRoot() is called twice

This commit is contained in:
Valentin Palkovic 2023-03-03 12:15:45 +01:00
parent 8c8974884f
commit 80a3cba00d
2 changed files with 8 additions and 5 deletions

View File

@ -128,11 +128,14 @@ export abstract class AbstractRenderer {
// Providers for BrowserAnimations & NoopAnimationsModule
analyzedMetadata.singletons,
importProvidersFrom(
...analyzedMetadata.imports.filter((imported) => {
const { isStandalone } = PropertyExtractor.analyzeDecorators(imported);
return !isStandalone;
})
...analyzedMetadata.imports
.filter((imported) => {
const { isStandalone } = PropertyExtractor.analyzeDecorators(imported);
return !isStandalone;
})
.map((imported) => imported.ngModule || imported)
),
...analyzedMetadata.imports.flatMap((imported) => imported.providers).filter(Boolean),
analyzedMetadata.providers,
storyPropsProvider(newStoryProps$),
].filter(Boolean);

View File

@ -65,6 +65,7 @@ export const createStorybookWrapperComponent = (
declarations,
imports,
exports: [...declarations, ...imports],
providers,
})
class StorybookComponentModule {}
@ -77,7 +78,6 @@ export const createStorybookWrapperComponent = (
template,
standalone: true,
imports: [ngModule],
providers,
styles,
schemas: moduleMetadata.schemas,
})