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

[Bug]: href with search filter on resource removes sidebar navigation active state for the page using it #1670

Open
BrunoDeye opened this issue Jun 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@BrunoDeye
Copy link

BrunoDeye commented Jun 4, 2024

Contact Details

discord @bruno_15980

What happened?

When using href with a search query on the resource, the function isSelected from the useNavigationResources in the source code doenst works correctly. Leading to a misfunction of the Sidebar navigation, that doesnt mark as active the nav button when the resource page is opened. My solution was to create a custom 'SidebarResourceSection' modifying the isSelected function to this:

image

the source code:

image

the resource with the href modified:

image

the behavior before the modification:

image

the behavior after the modification:

image

Bug prevalence

Always

AdminJS dependencies version

indiferent

What browsers do you see the problem on?

No response

Relevant log output

No response

Relevant code that's giving you issues

const isSelected = (href, location): boolean => {
const regExp = new RegExp(`${href}($|/)`)
return !!location.pathname.match(regExp)
}

@BrunoDeye BrunoDeye added the bug Something isn't working label Jun 4, 2024
@BrunoDeye BrunoDeye changed the title [Bug]: href with search filter on resource removes navigation active state for the page using it [Bug]: href with search filter on resource removes sidebar navigation active state for the page using it Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant