Skip to content
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

Addon-docs: Wait for the story component to render before emitting #16792

Merged
merged 3 commits into from
Nov 26, 2021

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Nov 26, 2021

Issue: #16745 #16779

It turned out the problem here was the source snippets weren't rendering for react on first render; leading to the set state problem when changing story.

What I did

See the inline comment:

// We need to wait for two things before we can consider the story rendered:
// (a) React's `useEffect` hook needs to fire. This is needed for React stories, as
// decorators of the form `<A><B/></A>` will not actually execute `B` in the first
// call to the story function.
// (b) The story function needs to acutally have been called.
// Certain frameworks (i.e.angular) don't actually render the component in the very first
// React render cycle, so we need to wait for the framework to actually do that

Previously we were only doing the second.

How to test

Visit react-ts and angular-cli in docs mode, change stories, etc.

@tmeasday tmeasday requested a review from shilman November 26, 2021 05:17
@nx-cloud
Copy link

nx-cloud bot commented Nov 26, 2021

Nx Cloud Report

CI ran the following commands for commit 068ee39. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to have solved at least one of our e2e tests as well! 💯

@shilman shilman changed the title Wait for the story component to render before emitting Addon-docs: Wait for the story component to render before emitting Nov 26, 2021
@shilman shilman merged commit 1799997 into next Nov 26, 2021
@shilman shilman deleted the 16745-fix-docs-story-rendered branch November 26, 2021 06:59
@tmeasday
Copy link
Member Author

Oh, there you go maybe the e2e test was there after all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants