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

Called Preview.selectSpecifiedStory() before initialization. #615

Closed
forabi opened this issue Oct 9, 2024 · 6 comments
Closed

Called Preview.selectSpecifiedStory() before initialization. #615

forabi opened this issue Oct 9, 2024 · 6 comments

Comments

@forabi
Copy link

forabi commented Oct 9, 2024

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

  1. Initialize a new expo project with web support
  2. Initialize storybook with react native support following the instruction in this repo's README
  3. Replace entrypoint for app with storybook's root UI
  4. Go to the web version of the storybook
Uncaught Error
Called `Preview.selectSpecifiedStory()` before initialization.

The preview needs to load the story index before most methods can be called. If you want
to call `selectSpecifiedStory`, try `await preview.initializationPromise;` first.

If you didn't call the above code, then likely it was called by an addon that needs to
do the above.
Source
 
 6928 |
async
 selectSpecifiedStory() {
 
 6929 |
  
if
 (
!
this
.
storyStoreValue)
>
 6930 |
    
throw
 
new
 
Kn
({
 
      |
          
^
 
 6931 |
      methodName
:
 
"selectSpecifiedStory"
 
 6932 |
    })
;
 
 6933 |
  
if
 (
this
.
selectionStore
.
selection) {
Call Stack
Xn#selectSpecifiedStory
node_modules/@storybook/core/dist/preview-api/index.js:6930:13
initialStory.then$argument_0
node_modules/@storybook/react-native/dist/index.js:1009:25
Showing all frames

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Code snippets
If applicable, add code samples to help explain your problem.

System:


Storybook Environment Info:

  System:
    OS: Linux 6.11 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 18.20.4 - /usr/bin/node
    npm: 10.7.0 - /usr/bin/npm
    pnpm: 9.9.0 - /usr/bin/pnpm <----- active
  Browsers:
    Chrome: 129.0.6668.89
  npmPackages:
    @storybook/addon-ondevice-actions: ^8.3.5 => 8.3.5 
    @storybook/addon-ondevice-controls: ^8.3.5 => 8.3.5 
    @storybook/addon-viewport: ^8.3.5 => 8.3.5 
    @storybook/react-native: ^8.3.5 => 8.3.5 

Additional context
Add any other context about the problem here.

@dannyhw
Copy link
Member

dannyhw commented Oct 10, 2024

weird I wasn't seeing that before but I was able to reproduce now, looking into it.

@dannyhw
Copy link
Member

dannyhw commented Oct 10, 2024

I might have a fix, will put out prerelease to test it soon in #616

@dannyhw
Copy link
Member

dannyhw commented Oct 10, 2024

@forabi could you try 8.3.6-alpha.0 ?

@forabi
Copy link
Author

forabi commented Oct 10, 2024

@dannyhw It's fixed

@dannyhw
Copy link
Member

dannyhw commented Oct 10, 2024

@forabi Thanks for checking! I will publish the patch to latest 🙏

@dannyhw
Copy link
Member

dannyhw commented Oct 10, 2024

8.3.6 is now live

@dannyhw dannyhw closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants