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

Fix router matching utility in case matching with "startsWith" and searched part is inside of current url #16245

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

Olegas
Copy link

@Olegas Olegas commented Oct 5, 2021

Issue: If the title of a story contains a word settings (i.e. Settings/Inner page/Inner component), resulted story page will have Controls tab all white and unclickable.
The reason it is overlapped with scrollbar components containers from the /settings route

<Route path="/settings" startsWith>

The root cause @storybook/router's function getMatch
export const getMatch = memoize(1000)(

The bug is inside condition - instead of failing fast if startsWith is set, we are going further and return on matchTarget
if (startsWithTarget || currentIsTarget || matchTarget) {

What I did

Fix is applied to getMatch function

How to test

Tests are added to @storybook/router
To reproduce case visually, create a story with name contains Settings/ (i.e. Settings/Page/Component) and try to render it with essentials addon enabled

@nx-cloud
Copy link

nx-cloud bot commented Oct 5, 2021

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b894d48. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@shilman
Copy link
Member

shilman commented Oct 26, 2021

@ndelangen mind taking a look at this one?

@shilman shilman added the linear label Nov 18, 2021
@stale stale bot added the inactive label Jan 9, 2022
@storybookjs storybookjs deleted a comment from stale bot Jun 30, 2022
@ndelangen ndelangen merged commit 3d3eba4 into storybookjs:next Jun 30, 2022
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.

3 participants