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

UI: Fix titles for addons/controls/panel tabs to support render fns and JSX elements #21650

Merged

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Mar 17, 2023

Closes #19989

What I did

The rules of hooks in React were not correctly applied. Hooks were used in a non-react way.

How to test

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Disable actions in preview.js
const preview = {
  parameters: {
    actions: {disable: true },
  },
};
  1. Open a Story. The Addon Tab Panel is visible and the app does not crash

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

@valentinpalkovic valentinpalkovic requested a review from yannbf March 17, 2023 13:04
@valentinpalkovic valentinpalkovic self-assigned this Mar 17, 2023
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-disabled-addon-interactions-issue branch 2 times, most recently from ef0a7fb to 165ee46 Compare March 17, 2023 13:32
@shilman shilman changed the title Update titles for addons, controls, and panel tabs to support render functions and JSX elements UI: Fix titles for addons, controls, and panel tabs to support render functions and JSX elements Mar 17, 2023
@shilman shilman changed the title UI: Fix titles for addons, controls, and panel tabs to support render functions and JSX elements UI: Fix titles for addons/controls/panel tabs to support render functions and JSX elements Mar 17, 2023
@shilman shilman changed the title UI: Fix titles for addons/controls/panel tabs to support render functions and JSX elements UI: Fix titles for addons/controls/panel tabs to support render fns and JSX elements Mar 17, 2023
@shilman shilman added the ui label Mar 17, 2023
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-disabled-addon-interactions-issue branch 6 times, most recently from 0611d02 to d9e98a9 Compare March 20, 2023 15:56
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-disabled-addon-interactions-issue branch from d9e98a9 to 4d07473 Compare March 20, 2023 17:52
Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yannbf
Copy link
Member

yannbf commented Mar 21, 2023

Hey @valentinpalkovic I actually found an issue:

  1. Open Storybook
  2. Add actions: { disable: true } and see it update correctly
  3. change to actions: { disable: false } or remove the line altogether, and see that the panel does not get updated (at the end of the gif I had to refresh the browser):

2023-03-21 18 04 22

Is this a memo issue?

@valentinpalkovic
Copy link
Contributor Author

I have encountered it as well, but it is not related to this bug and should be fixed separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: addon-interactions + disabled actions breaks storybook
3 participants