Skip to content

fix: include base path when navigating multica tabs#610

Merged
unknownzjc merged 1 commit into
devfrom
fix-navigation-multica
Jul 23, 2026
Merged

fix: include base path when navigating multica tabs#610
unknownzjc merged 1 commit into
devfrom
fix-navigation-multica

Conversation

@unknownzjc

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

multica 页面通过 tab.location.href 跳转已有标签页时,直接使用 new URL(path, origin) 拼接地址,丢失了部署时配置的 base path(如 /cloud),导致子路径部署下跳转 404。

改动:

  • router.ts 新增 href() 帮助函数,在 origin 前拼接 env.BASE_PATH(去除末尾斜杠),并规范 path 前导斜杠
  • multica-page.tsx 的标签页跳转改用 href(path)
  • router.test.ts 新增单测,覆盖 VITE_BASE_PATH=/cloudhref 生成 {origin}/cloud/... 的场景

How did you verify your code works?

本地验证功能正常;bun test src/lib/router.test.ts 4 个用例全部通过,覆盖 href 拼接 base path 的场景

Screenshots / recordings

导航逻辑修复,无界面视觉变化,无截图。

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@unknownzjc
unknownzjc merged commit 76ad7af into dev Jul 23, 2026
5 checks passed
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.

1 participant