-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 APP_INITIALIZER not firing #22674
Comments
Have you followed the migration guide as suggested in the discussion in #21218? |
I'm encountering a similar issue, even after following the migration guide. // preview.ts
export const decorators = [
applicationConfig({
providers: [
{
provide: APP_INITIALIZER,
useFactory: () => {
console.log('Hello from useFactory');
},
multi: true,
},
],
}),
]; I'd expect to see "Hello from useFactory" logged to console, but I don't see any message logged. Am I misunderstanding the migration instructions? Do I need to do something extra to make Angular core available to Storybook? |
I've created a reproduction here: https://github.com/rdebeasi/repro-storybook-22674 If you need any other information, just let me know. Thanks! |
Hi @rdebeasi, I have checked out your repro. Unfortunately, I was not able to install the dependencies, because in the {
"name": "angular-latest",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"storybook": "ng run angular-latest:storybook",
"build-storybook": "ng run angular-latest:build-storybook"
},
"private": true,
"dependencies": {
"@angular/animations": "^16.1.1",
"@angular/common": "^16.1.1",
"@angular/compiler": "^16.1.1",
"@angular/core": "^16.1.1",
"@angular/forms": "^16.1.1",
"@angular/platform-browser": "^16.1.1",
"@angular/platform-browser-dynamic": "^16.1.1",
"@angular/router": "^16.1.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.0",
"@angular/cli": "~16.1.0",
"@angular/compiler-cli": "^16.1.1",
"@compodoc/compodoc": "^1.1.21",
"@storybook/addon-essentials": "^7.1.0-alpha.36",
"@storybook/addon-interactions": "^7.1.0-alpha.36",
"@storybook/addon-links": "^7.1.0-alpha.36",
"@storybook/angular": "^7.1.0-alpha.36",
"@storybook/blocks": "^7.1.0-alpha.36",
"@storybook/testing-library": "^0.0.14-next.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.1.0-alpha.36",
"typescript": "~5.0.2"
}
} After starting Storybook, I get the console.log in the browser. So I cannot reproduce the issue :/ |
Thanks for taking a look! I tried updating package.json and installing from the public npm registry, and I do indeed get the log entry when viewing the "button" story. I don't see the log entry when viewing the "Introduction" story, however. Do you see the same behavior? Is that expected? |
The |
Ah, thank you for explaining that! I think this behavior might have changed in Storybook 7. I have a Storybook 6 project that used Is this indeed a breaking change when moving from Storybook 6 to Storybook 7? If so, would it be useful to add this information to the framework-specific changes listed in the migration guide? |
@rdebeasi I don't think it was intended, but rather a side-effect of switching to the new standalone API. Would you like to add an entry to the migration guide? :) |
@SatarisGIT Do you still have issues even by following the migration guide? I would like to close this ticket otherwise. |
I am closing the ticket. @SatarisGIT Please let me know if you still encounter any issues. |
Hi @valentinpalkovic I changed preview.ts below
But I can't see my log |
Describe the bug
Duplicate of: #21121
But on version: 7.0.12
To Reproduce
No response
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: