fix: include base path when navigating multica tabs#610
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
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=/cloud时href生成{origin}/cloud/...的场景How did you verify your code works?
本地验证功能正常;
bun test src/lib/router.test.ts4 个用例全部通过,覆盖 href 拼接 base path 的场景Screenshots / recordings
导航逻辑修复,无界面视觉变化,无截图。
Checklist