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

InteractionsAddon: Improve code quality by using title as FC & sharing state via useAddonState #23291

Merged
merged 14 commits into from
Jul 7, 2023

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Jul 3, 2023

Telescoped off: #23288

What I did

  • refactor the addon/interactions to have less state updates
  • refactor the addon/interactions to share state using useAddonState
  • refactor the addon/interactions to not use portals to update it's own title, but use the fact tab titles can be a FC, and connect to the same addon-state

How to test

  • Addon interactions should function the same as before, though the addon now does use a different visual indicator in the tab button

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

@ndelangen ndelangen self-assigned this Jul 3, 2023
@ndelangen ndelangen added the maintenance User-facing maintenance tasks label Jul 3, 2023
@ndelangen ndelangen requested a review from yannbf July 3, 2023 22:53
@ndelangen ndelangen changed the title InteractionsAddon: Improve code quality by using title as FC & sharing state via useAddonState InteractionsAddon: Improve code quality by using title as FC & sharing state via useAddonState Jul 4, 2023
@ndelangen ndelangen changed the title InteractionsAddon: Improve code quality by using title as FC & sharing state via useAddonState InteractionsAddon: Improve code quality by using title as FC & sharing state via useAddonState Jul 4, 2023
@ndelangen ndelangen force-pushed the norbert/improve-interaction-addon branch from 69fc710 to 0a1e471 Compare July 4, 2023 09:49
Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

LGTM! 💪

@ndelangen
Copy link
Member Author

Looks like something about vite + interactions is extremely flaky, I'll need to investigate. 😢

Base automatically changed from norbert/ui-tabs-types-improvements to release/7.2 July 6, 2023 22:29
So… I discovered after a bunch of :computer-rage: ..
That the e2e test for interactions sometimes toggles the toolbar off.
When this happens it can’t click on the button to remount the story.
The toolbar disappears when playwright clicks on the addon tab, which appear like it refreshes storybook somehow, and then the toolbar disappears.
I cannot get playwright to do this locally, but I can see that something seems to be pressing t? Which toggles the toolbar.
What causes the refresh? what causes the toolbar to be toggle off? who knows?
I was trying to detect the presence of the toolbar to toggle back on, if needed,, and this is when things go weird.
Playwright tried to click the button, and can’t.. because it’s not visible.
So obviously I add a if statement, that if the button isn’t visible, it should do a procedure to ensure it will be, then try again.
Playwright tells me the button IS visible, but then when it tries to click says it isn’t. In addition using page.keyboard.press('t') doesn’t work to toggle the toolbar, very strange.
I even tried isWithinViewport()this suggests it’s in the viewport as well.
@ndelangen ndelangen merged commit 2c9b425 into release/7.2 Jul 7, 2023
@ndelangen ndelangen deleted the norbert/improve-interaction-addon branch July 7, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: interactions maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants