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: Expand sidebar for selected story when using composition #23781

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

joaonunomota
Copy link
Contributor

@joaonunomota joaonunomota commented Aug 10, 2023

Closes #22878

What I did

  • Update the isExpanded variable when a selectedStoryId is found in the index provided to the Ref.
  • The Refs component is expanded when the selected story is inside the Ref and either:
    • storybook is initialized
    • the user switches to a new story
  • This follows the current behaviour for automatically expanding nodes in the Tree component

Expanding when opening storybook:

expand-on-refresh

Expand when switching story using shortcut:

ref-expand-on-next-story

How to test

  1. Create two sandboxes
  2. Add the following to main.ts on the first storybook:
  refs: {
    other: {
      title: 'other',
      url: 'http://localhost:6007',
      expanded: false
    }
  }
  1. Run the sandboxes with yarn storybook and yarn storybook --port 6007
  2. Access a story within the composition and refresh the page to see the ref open automatically
  3. Navigate between stories within the composition and to see the ref open automatically after being closed

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

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@joaonunomota
Copy link
Contributor Author

Let me know if there are any issues with the pull request @yannbf :) Happy to make changes if necessary

@ndelangen ndelangen merged commit 85ce31e into storybookjs:next Sep 19, 2023
9 checks passed
@joaonunomota joaonunomota deleted the expand-refs branch September 19, 2023 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: loading a composition story in a new tab doesn't expand the menu
5 participants