SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.06k stars 646 forks source link

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

Open BrunoDeye opened 1 month ago

BrunoDeye commented 1 month ago

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

https://github.com/SoftwareBrothers/adminjs/blob/e27e885e819529b0dd9ba2e5b64e6afade1b59aa/src/frontend/hooks/use-navigation-resources.ts#L14-L17