-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Angular ɵɵinvalidFactoryDep after upgrading to storybook 7 #23534
Comments
I experience the same issue. |
Version 7.0.26 unfortunately breaks for me on |
Unfortunately, same still happens for v7.2.0 / 7.2.1. Had to revert back to 7.0.26. "@angular/core": "15.2.6" |
For me version 7.2.0 works Hope that helps for you as well! |
@warri93 , thx for the hint! Appreciated! But do you believe it's a good idea running Angular in dev mode on a SB production environment? Not sure in which mode Angular runs inside SB, but I still believe it also should run in prod mode for a production env, right? Hence I'd assess disabling prod mode more as a |
Just noticed this log into console when accessing our deployed production instance:
So, it means that even right now SB runs Angular in dev mode regardless of dev or prod build :/ At least this sheds another light on the above solution setting |
I got the same error with my setup:
I confirm that workaround in #23534 (comment) works and it works on Chromatic too. I don't know the effects of setting |
I can confirm this issue also is present with Storybook For us though it seems to only occur in stories with Angular components that extend |
Same here ...comment: #23534 (comment) fix the issue. But I would like to know if it is the correct workaround. Any advice from the core team? |
I guess the workaround is our only solution for this issue atm. If someone could provide a minimal reproduction, we might be able to investigate the issue further and provide a proper solution. |
On my side, preparing a minimal project to reproduce that issue is quite complex. I work in a commercial enterprise solution. I have tried preparing a simple project with @angular/cdk without success. @hrmcdonald do you have any advice/sample using just cdk? |
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
If anyone needs a workaround for this a simple one that we discovered was to include the constructor, e.g. @Component({
selector: 'my-dialog-container',
templateUrl: './dialog-container.component.html',
})
export class MyDialogContainerComponent extends CdkDialogContainer {} Would become: @Component({
selector: 'my-dialog-container',
templateUrl: './dialog-container.component.html',
})
export class MyDialogContainerComponent extends CdkDialogContainer {
constructor(
elementRef: ElementRef,
focusTrapFactory: FocusTrapFactory,
interactivityChecker: InteractivityChecker,
ngZone: NgZone,
overlayRef: OverlayRef,
focusMonitor: FocusMonitor
) {
super(
elementRef,
focusTrapFactory,
document,
config,
interactivityChecker,
ngZone,
overlayRef,
focusMonitor
);
}
} Ensuring the constructor is there to forward all the dependencies to the base class resolved these issues for us. |
I can confirm that @ashley-hunter workaround is working. To follow what @hrmcdonald supposed, it rely on any component that extends one of For me it was the CdkStepper:
So search any |
Describe the bug
I upgraded from storybook 6 to storybook 7.
Locally everything works fine when starting storybook but as soon as I build storybook I'm getting a
ɵɵinvalidFactoryDep
error on my IconRegistry.I'm using MatIconRegistry from angular material and extend it with my own IconRegistry to have some more functionality. This is done within a module which is imported in my standalone component.
When running my angular application in production mode, everything is fine and I'm not getting any errors. Building storybook gives errors on this (
build-storybook
). Resulting in the following:Error: NG0202 ɵɵinvalidFactoryDep
.My module looks like this:
@NgModule({ providers: [ { provide: MatIconRegistry, useClass: IconRegistry, }, { provide: MATERIAL_SANITY_CHECKS, useValue: false, }, ], }) export class IconModule { constructor(iconRegistry: MatIconRegistry) { iconRegistry.addSvgIconSetInNamespace(...); iconRegistry.addSvgIconSetInNamespace(...); } }
My IconRegistry:
@Injectable() export class IconRegistry extends MatIconRegistry { getNamedSvgIcon(name: string, namespace: string = ''): Observable<SVGElement> { return super.getNamedSvgIcon(name, namespace).pipe( map((svg: SVGElement) => { svg.setAttribute(...); return svg; }) ); } }
My versions:
"@angular/core": "15.2.0",
"@nrwl/storybook": "15.9.0",
"@storybook/addon-essentials": "7.0.27",
"@storybook/angular": "7.0.27",
"@storybook/core-server": "7.0.27",
"webpack": "5.88.1",
Not sure what's going wrong here. Can anybody give me some pointers?
Thanks!
To Reproduce
No response
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: