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 useStoryPrepared hook failing with undefined data #22631

Merged
merged 6 commits into from
Nov 22, 2023

Conversation

SpookyJelly
Copy link
Contributor

@SpookyJelly SpookyJelly commented May 19, 2023

Closes #

What I did

api.getData returns undefined sometimes. which is used by isPrepared, the inner logic of useStoryPrepared hook.
however, isPrepared hook access to 'type' att without any check.
so I added an exception for this. Now hooks works as expected.

How to test

  1. Clone this branch.
  2. Type this where can use manager-apiimport { useStoryPrepared } from '@storybook/manager-api
  3. Check hooks works without error

it

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

🦋 Canary release

This pull request has been released at the npm dist tag pr-22631. Install it by pinning all your Storybook dependencies to that tag.

More information
Published version 7.1.1-pr-22631-1689802540-351503cb.0
npm dist tag @storybook/cli@pr-22631
Triggered by @JReinhold
Repository SpookyJelly/storybook
Branch patch-1
Commit 351503cb
Datetime Wed Jul 19 21:35:40 UTC 2023 (1689802540)
Workflow run 5604333170

To request a new release of this PR ping the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=22631

sometimes, `api.getData` returns undefined. which is used by isPrepared. I added a exception for this
@JReinhold JReinhold self-assigned this May 22, 2023
@SpookyJelly
Copy link
Contributor Author

I will check these skipped workflows

@SpookyJelly SpookyJelly marked this pull request as draft May 23, 2023 03:52
Fixed a wrong lint.
@storybook-bot
Copy link
Contributor

Failed to publish canary version of this pull request, triggered by @JReinhold. See the failed workflow run at: https://github.com/storybookjs/storybook/actions/runs/5604266451

@JReinhold JReinhold added the bug label Nov 22, 2023
@JReinhold JReinhold changed the title fix: error on using useStoryPrepared hook Core: Fix useStoryPrepared hook failing with undefined data Nov 22, 2023
@JReinhold JReinhold merged commit 6166ab4 into storybookjs:next Nov 22, 2023
51 of 57 checks passed
@github-actions github-actions bot mentioned this pull request Nov 22, 2023
36 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.

4 participants