Skip to content

Core: Fix useStoryPrepared hook failing with undefined data#22631

Merged
JReinhold merged 6 commits into
storybookjs:nextfrom
SpookyJelly:patch-1
Nov 22, 2023
Merged

Core: Fix useStoryPrepared hook failing with undefined data#22631
JReinhold merged 6 commits into
storybookjs:nextfrom
SpookyJelly:patch-1

Conversation

@SpookyJelly
Copy link
Copy Markdown
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
Copy Markdown
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.
@SpookyJelly SpookyJelly marked this pull request as ready for review May 23, 2023 03:57
@yannbf yannbf added core ci:normal Run our default set of CI jobs (choose this for most PRs). labels Jul 19, 2023
@storybook-bot
Copy link
Copy Markdown
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
@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

Labels

bug ci:normal Run our default set of CI jobs (choose this for most PRs). core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants