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

[V6.2.9] Control type OBJECT's value is not set on initial load #15272

Open
annayap opened this issue Jun 17, 2021 · 7 comments
Open

[V6.2.9] Control type OBJECT's value is not set on initial load #15272

annayap opened this issue Jun 17, 2021 · 7 comments

Comments

@annayap
Copy link

annayap commented Jun 17, 2021

BUG DESCRIPTION

  • Controls of object type is not set on initial load of story:
    • image
  • But it will be set once you click on Reset controls button.
    • control object gets set on reset only

System

npx sb@next info output:

Environment Info:

  System:
    OS: macOS 11.2.2
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Binaries:
    Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
    npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.106
    Firefox: 89.0
    Safari: 14.0.3
  npmPackages:
    @storybook/addon-a11y: ^6.2.1 => 6.2.9 
    @storybook/addon-actions: ^6.2.1 => 6.2.9 
    @storybook/addon-essentials: ^6.2.1 => 6.2.9 
    @storybook/addon-knobs: ^6.2.1 => 6.2.9 
    @storybook/addon-links: ^6.2.1 => 6.2.9 
    @storybook/addon-options: ^5.3.21 => 5.3.21 
    @storybook/react: ^6.2.1 => 6.2.9 
    @storybook/theming: ^6.2.1 => 6.2.9 

Additional context
ℹ️ : Last time this worked for us was in version 6.2.1

@shilman
Copy link
Member

shilman commented Jun 17, 2021

Try upgrading to the latest prerelease:

npx sb@next upgrade --prerelease

Does that fix it?

@annayap
Copy link
Author

annayap commented Jun 18, 2021

@shilman Just tried to upgrade to latest pre-release

Environment Info:

  System:
    OS: macOS 11.2.2
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Binaries:
    Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
    npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 89.0
    Safari: 14.0.3
  npmPackages:
    @storybook/addon-a11y: ^6.3.0-rc.10 => 6.3.0-rc.10 
    @storybook/addon-actions: ^6.3.0-rc.10 => 6.3.0-rc.10 
    @storybook/addon-essentials: ^6.3.0-rc.10 => 6.3.0-rc.10 
    @storybook/addon-knobs: ^6.2.9 => 6.2.9 
    @storybook/addon-links: ^6.3.0-rc.10 => 6.3.0-rc.10 
    @storybook/addon-options: ^6.0.0-alpha.29 => 6.0.0-alpha.29 
    @storybook/react: ^6.3.0-rc.10 => 6.3.0-rc.10 
    @storybook/theming: ^6.3.0-rc.10 => 6.3.0-rc.10 

But the problem is still there, the object's value still isn't set on load:
sb-v2 3-prerelease-control-object-issue

@annayap annayap changed the title [V6.2.9] Control type object's value is not set on initial load [V6.2.9] Control type OBJECT's value is not set on initial load Jun 18, 2021
@shilman
Copy link
Member

shilman commented Jun 18, 2021

Thanks for trying that @annayap. I tried reproducing, but couldn't.

Do you happen to have a reproduction repo you can share? If not, can you create one using npx sb@next repro, following the instructions, and linking it in your issue description?

@danielbeckmann
Copy link

We were also facing that issue with Storybook for Angular.

For us it was related with having an empty string as key for radio option labels in another story file.

Main.argTypes = {
  arrow: {
    control: {
      type: 'radio',
      labels: {
        '': 'None',   // 👈 this empty string is the problem
        'left': 'Arrow left',
        'right': 'Arrow right'
      },
      options: ['', 'left', 'right']
    }
  }
}

This was done to properly label the empty string option in storybook. This is also working for the actual story, where it was used. But as a side effect some control type for 'object' in other stories do not work properly anymore. So I guess this is a bug in storybook, because this is valid in JSON.

Hope that helps. If not, maybe it's something similar like that. Our problem at least shows that story files can have an impact on other story files, which should not happen from my point of view.

@shilman
Copy link
Member

shilman commented Jul 29, 2021

@danielbeckmann Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro.

@danielbeckmann
Copy link

Hi @shilman, sure: https://github.com/danielbeckmann/storybook-issue-15272
The steps to reproduce are in the README.md file.

@shilman shilman added this to the 6.4 improvements milestone Aug 2, 2021
@shilman
Copy link
Member

shilman commented Aug 2, 2021

This is indeed a strange one. @ghengeveld I reproduced but it's not immediately obvious what's going on here. Can you please take a look?

@ghengeveld ghengeveld self-assigned this Aug 4, 2021
@shilman shilman removed this from the 6.4 improvements milestone May 20, 2022
@shilman shilman removed the P0 label Oct 18, 2022
@shilman shilman removed the tiny label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants