Repository navigation
fix: shared knowledge base hit test should be hidden - #8229
Conversation
| meta: { title: 'knowledge.hitTest.title', order: 10, hidden: true}, | ||
| }, | ||
| { | ||
| path: 'problem', |
There was a problem hiding this comment.
Review of the diff
Assumptions: this is a Vue Router 4 route config (RouteRecordRaw[]), and hidden is a custom RouteMeta flag consumed by your menu/sidebar logic.
Potential issues
-
Redirect target may not exist / may be conditional
redirect: { name: 'workspace-shared-knowledge-problem' }
The diff only shows the
problemchild starting, not itsname. If that child is registered later, behind a feature flag, permission check, or dynamic route injection, this redirect will fail at runtime with a “No match” warning. Verifyworkspace-shared-knowledge-problemis always registered as a sibling under the same parent. -
Redirecting to a
hiddenroute can break menu highlighting
hit-testis nowhidden: true, and the parent redirects toproblem. Ifproblemis also hidden (or not in the sidebar), the parent menu itemknowledge.menu.retrievalmay no longer appear active when landing on the redirect target. If so, setmeta.activeMenuon the target route, or ensure the parent’s active state is derived from the route path. -
Behavior change for existing links/bookmarks
Anyone navigating to/retrievalnow lands onprobleminstead ofhit-test. Confirm this is intentional and that deep links tohit-teststill work (hiding only affects the menu, not URL access). -
hiddenonly hides UI, not access
If the goal is to restrict access to hit-test,hidden: trueis insufficient. Use route guards / permission meta. -
Type safety for custom meta
IfRouteMetais not augmented,hiddenmay cause a TS error. Ensure:declare module 'vue-router' { interface RouteMeta { hidden?: boolean } }
-
Formatting
meta: { title: 'knowledge.hitTest.title', order: 10, hidden: true},
Missing space before
}— Prettier/ESLint will flag this. Usehidden: true }. -
Redundant
orderon a hidden route
order: 10onhit-testhas no effect if it’s hidden from the menu. Harmless, but can be removed for clarity.
Suggestions
- Confirm the
problemchild’s exactnamematches the redirect string. - Prefer a route
redirectfunction if the target depends on params/permissions:redirect: () => ({ name: 'workspace-shared-knowledge-problem' })
- Add a test/assertion that every
redirect.nameresolves to a registered route. - If
problemshould be the visible default, consider giving itorder: 10and movinghit-testto a higher order or removing itsorder. - If
hit-testshould remain navigable but not shown, keephidden: true; otherwise if it’s deprecated, consider removing the route and adding a redirect fromhit-testtoproblem.
Bottom line: the main risks are the redirect pointing to a possibly unregistered/conditional route, and losing sidebar active-state highlighting when redirecting to a hidden route. The rest are minor formatting/typing concerns.
fix: shared knowledge base hit test should be hidden