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

Core: Only call setup function on story navigation #15244

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

shilman
Copy link
Member

@shilman shilman commented Jun 15, 2021

Issue: N/A

What I did

CSF3 (experimental) introduces a setup function that gets called after every story render. The problem is that if you update the controls, it causes the setup function to re-render, and args changes can result in elements not being on screen when the setup function needs them.

The solution in this PR is to not run the setup function when (the confusingly named) forceRender is set. forceRender means that there was no story navigation and we want to force the story to re-render for some other reason.

How to test

See the AccountForm "Verification Password Mismatch" demo in examples/react-ts. After the setup function finishes, toggle the passwordVerification boolean. This causes a crash prior to this PR, but simply adjusts the prop as expected after this PR.

self-merging @tmeasday

@nx-cloud
Copy link

nx-cloud bot commented Jun 15, 2021

Nx Cloud Report

CI ran the following commands for commit d705994. 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.

@shilman shilman merged commit 0d4dc68 into next Jun 15, 2021
@shilman shilman deleted the fix/only-setup-on-story-nav branch June 15, 2021 02:17
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.

None yet

1 participant