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: Don't allow passing of={} with undefined prop #21452

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Mar 7, 2023

Closes #21441

What I did

As it is easy in MDX to write (e.g.) <Story of={Something.Undefined} /> and get no prompt from the editor, we need to disambiguate from <Story /> where we fallback to the primary.

Here we throw if we detect this situation.

image

How to test

  • See stories.
  • Try yourself in a sandbox with some of the blocks.

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"]

@tmeasday tmeasday marked this pull request as ready for review March 8, 2023 01:33
@yannbf
Copy link
Member

yannbf commented Mar 8, 2023

@tmeasday seems like the change is causing breakages in many stories like so:
image

@tmeasday
Copy link
Member Author

tmeasday commented Mar 8, 2023

Good thing we have tests huh @yannbf!

Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

Looks good! It's a shame this can't be generalized into useOf, but that would require passing in props to useOf which wouldn't be worth it I think.

@tmeasday tmeasday merged commit 0a8dbb8 into next Mar 8, 2023
@tmeasday tmeasday deleted the 21441-fix-missing-of branch March 8, 2023 20:10
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.

[Bug]: <Story of={obj.undefined} /> renders the primary story
3 participants