question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Large Angular component initialization not complete when story_store applyLoaders promise resolves

See original GitHub issue

Describe 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.

image

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

image

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, May 13, 2021

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! 🙏

0reactions
anwalkerscommented, Jun 9, 2021

@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

image

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

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Large Angular component initialization not complete ... - Issuehunt
Large Angular component initialization not complete when story_store applyLoaders promise resolves #14905. anwalkers posted onGitHub. Describe the bug.
Read more >
How to defer Main component's initialization of dependent ...
My biggest problem is the inability to defer loading of main component's dependent child component till some promise gets resolved.
Read more >
AfterViewInit - Angular
A callback method that is invoked immediately after Angular has completed initialization of a component's view. It is invoked only once when the...
Read more >
How to initialize a service on startup - VitaminDev
Sometimes, you need to initialize a service before your angular ... startup will be blocked for 5 seconds, until the promise is resolved....
Read more >
Implementing Modal Dialog Functions With Promise-based ...
Create a specific Angular component that will represent the dialog ... resolved or rejected // Note that this branch is not visible to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found