fix(web): 修复静态导出版任务列表页丢失全局头部
判断任务详情页的前缀 "/function/tasks/" 在 trailingSlash 静态导出下 会把列表页自身(pathname 为 "/function/tasks/")也匹配进去,导致发布 二进制里的列表页走了 full-bleed 分支,侧边栏折叠、搜索、版本号、主题 与账号入口整条 header 都不渲染;dev 与 mock demo 未开 trailingSlash 故看不出问题。判前缀前先剥掉尾部斜杠。
This commit is contained in:
1 parent
55869705ad
commit
564096c063
1 file changed
+4
-1
@@ -25,7 +25,10 @@ function isFullBleed(pathname: string) {
|
||||
return pathname;
|
||||
}
|
||||
})();
|
||||
return p.startsWith("/function/tasks/");
|
||||
// 静态导出开了 trailingSlash,列表页自身的 pathname 是 "/function/tasks/",
|
||||
// 先去掉尾斜杠再判前缀,否则列表页会被误判成详情页而丢掉全局头部。
|
||||
const normalized = p.replace(/\/+$/, "");
|
||||
return normalized.startsWith("/function/tasks/");
|
||||
}
|
||||
|
||||
export function MainContent({ children }: { children: ReactNode }) {
|
||||
|
||||
Reference in new issue
Block a user