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

Docs: Cleanup with Promise instead of setTimeout #21476

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

JReinhold
Copy link
Contributor

What I did

This PR changes the cleanup of stories in docs mode to be executed with a Promise, instead of setTimeout as introduced in #21214

When navigating between two docs entries, the setTimeout would cause teardown of the first set of stories to be called after renderToCanvas of the second set of stories. This results in the primary story from the second set of stories getting teared down and you end up with a blank canvas.

Using Promise.resolve instead makes sure that teardown happen before renderToCanvas, while still eliminating the React warning.

How to test

Navigate between two docs entries and see that there is no blank canvas anymore.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

👏

@JReinhold JReinhold merged commit bf1dfd4 into next Mar 8, 2023
@JReinhold JReinhold deleted the fix-docs-blank-canvases branch March 8, 2023 13:14
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