Skip to content

fix: shared knowledge base hit test should be hidden - #8229

Merged
peslyn merged 1 commit into
v3from
pr@v3@fix_shared_knowledge_base_hit_test_should_be_hidden
Nov 30, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@fix_shared_knowledge_base_hit_test_should_be_hidden

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: shared knowledge base hit test should be hidden

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.

@peslyn
peslyn merged commit 4261e8c into v3 Nov 30, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@fix_shared_knowledge_base_hit_test_should_be_hidden branch November 30, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants