Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/src/router/admin/workspace/modules/knowledge-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export const sharedKnowledgeRoutes: RouteRecordRaw[] = [
{
path: 'retrieval',
name: 'workspace-shared-knowledge-retrieval',
redirect: { name: 'workspace-shared-knowledge-hit-test' },
redirect: { name: 'workspace-shared-knowledge-problem' },
meta: { title: 'knowledge.menu.retrieval', icon: 'icon_trace_outlined', order: 30 },
children: [
{
path: 'hit-test',
name: 'workspace-shared-knowledge-hit-test',
component: () => import('@/views/knowledge-detail/hit-test/index.vue'),
meta: { title: 'knowledge.hitTest.title', order: 10 },
meta: { title: 'knowledge.hitTest.title', order: 10, hidden: true},
},
{
path: 'problem',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Redirect target may not exist / may be conditional

    redirect: { name: 'workspace-shared-knowledge-problem' }

    The diff only shows the problem child starting, not its name. 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. Verify workspace-shared-knowledge-problem is always registered as a sibling under the same parent.

  2. Redirecting to a hidden route can break menu highlighting
    hit-test is now hidden: true, and the parent redirects to problem. If problem is also hidden (or not in the sidebar), the parent menu item knowledge.menu.retrieval may no longer appear active when landing on the redirect target. If so, set meta.activeMenu on the target route, or ensure the parent’s active state is derived from the route path.

  3. Behavior change for existing links/bookmarks
    Anyone navigating to /retrieval now lands on problem instead of hit-test. Confirm this is intentional and that deep links to hit-test still work (hiding only affects the menu, not URL access).

  4. hidden only hides UI, not access
    If the goal is to restrict access to hit-test, hidden: true is insufficient. Use route guards / permission meta.

  5. Type safety for custom meta
    If RouteMeta is not augmented, hidden may cause a TS error. Ensure:

    declare module 'vue-router' {
      interface RouteMeta { hidden?: boolean }
    }
  6. Formatting

    meta: { title: 'knowledge.hitTest.title', order: 10, hidden: true},

    Missing space before } — Prettier/ESLint will flag this. Use hidden: true }.

  7. Redundant order on a hidden route
    order: 10 on hit-test has no effect if it’s hidden from the menu. Harmless, but can be removed for clarity.

Suggestions

  • Confirm the problem child’s exact name matches the redirect string.
  • Prefer a route redirect function if the target depends on params/permissions:
     redirect: () => ({ name: 'workspace-shared-knowledge-problem' })
  • Add a test/assertion that every redirect.name resolves to a registered route.
  • If problem should be the visible default, consider giving it order: 10 and moving hit-test to a higher order or removing its order.
  • If hit-test should remain navigable but not shown, keep hidden: true; otherwise if it’s deprecated, consider removing the route and adding a redirect from hit-test to problem.

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.

Expand Down
Loading