Large Angular component initialization not complete when story_store applyLoaders promise resolves
See original GitHub issueDescribe the bug
My best guess is that larger Angular component stories or components that rely on large external libraries, for example our common map control is a large component and depends on the google javascript mapping API, aren’t completely constructed when the promise from the applyLoaders() method in the story_store resolves. I have seen strange typescript transpilation of async/await in my code before…
If one of the larger component stories is the first loaded, usually from a deep link to the story, all subsequent stories are broken and you can’t get storybook back to a running state without reloading from the base URL or a small story URL.
There is a console error thrown from the StorybookWrapper stating provider.ngAfterViewInit is not a function when a larger component story is the first story loaded.

If I add a check in core.js for undefined on provider functions I can get everything loaded correctly.

If this same larger component story is the second story loaded, navigated to after a smaller component story loads without error, then the larger story will also load without error, and all subsequent stories without error.
To Reproduce
I tried to pull your repo and introduce a larger component user story but ran into issues with puppeteer on WSL2 and also out of time to try and setup a PR with an example. Was thinking about using the google map from the angular material components library.
System
Environment Info:
System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Binaries: Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.21.0/bin/yarn npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm Browsers: Chrome: 90.0.4430.212 npmPackages: @storybook/addon-a11y: ^6.2.9 => 6.2.9 @storybook/addon-essentials: ^6.2.9 => 6.2.9 @storybook/addon-storysource: ^6.2.9 => 6.2.9 @storybook/angular: ^6.2.9 => 6.2.9
Additional context
Not sure if this is related to issue Storybook 6.2.0-beta new angular renderer ovverides properties
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)

Top Related StackOverflow Question
Can you please create a reproduction by running
npx sb@next repro, following the instructions, and linking it in your issue description? We prioritize issues with reproductions over those without. Thank you! 🙏@shilman From our application using release candidate.
OUR APPLICATION Environment Info:
System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Binaries: Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.21.0/bin/yarn npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm Browsers: Chrome: 90.0.4430.212 npmPackages: @storybook/addon-a11y: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/addon-essentials: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/addon-storysource: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/angular: 6.3.0-rc.0 => 6.3.0-rc.0
REPRO PROJECT Environment Info:
System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Binaries: Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node Yarn: 2.4.1 - ~/.nvm/versions/node/v12.21.0/bin/yarn npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm Browsers: Chrome: 90.0.4430.212 npmPackages: @storybook/addon-actions: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/addon-docs: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/addon-essentials: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/addon-links: 6.3.0-rc.0 => 6.3.0-rc.0 @storybook/angular: 6.3.0-rc.0 => 6.3.0-rc.0