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: Fix error thrown if docs.defaultName is unset #23893

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

stilt0n
Copy link
Contributor

@stilt0n stilt0n commented Aug 19, 2023

Closes #23860

What I did

Fixed a regression that was introduced in #23182 where an invariant was used to enforce defaultName being defined. When defaultName is undefined, it should default to 'Docs' rather than triggering an invariant. See MIGRATION.md here.

How to test

Run a sandbox with:

docs: {
  autodocs: true,
  defaultName: undefined,
}

In the main.ts config. Should not get any invariant messages in the logs.

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

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

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

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.

Thanks for this! 💪

defaultName will be set by addon-docs, so this would only fail if a user doesn't have addon-docs installed and sets autodocs: true, which is a weird case.

However it is valid, and we should just ignore it instead of throwing an error.

@JReinhold JReinhold changed the title Core: Fix regression caused by defaultName invariant Core: Fix error thrown if docs.defaultName is unset Aug 21, 2023
@JReinhold JReinhold merged commit 03b85f4 into storybookjs:next Aug 21, 2023
10 checks passed
@github-actions github-actions bot mentioned this pull request Aug 21, 2023
20 tasks
@stilt0n stilt0n deleted the fix-invariant-bug branch August 22, 2023 02:55
@github-actions github-actions bot mentioned this pull request Aug 23, 2023
22 tasks
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]: Invariant failed: expected a defaultName property in options.docs
3 participants