fix public work detail not found recovery
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-11 19:52:25 +08:00
parent 7cea41c911
commit 54968701f0
7 changed files with 182 additions and 8 deletions

View File

@@ -28,3 +28,27 @@ export function resolveRuntimeNotFoundRecoveryAction(
return null;
}
/**
* 中文注释:公开作品详情页和运行态深链都可能在作品被删除或下架后失效。
* 这类入口没有上一层可回退的详情数据,确认提示后统一回首页,避免空详情页白屏。
*/
export function resolveWorkNotFoundRecoveryAction(
pathname: string,
): RuntimeNotFoundRecoveryAction | null {
const normalizedPath = pathname.trim().toLowerCase().replace(/\/+$/u, '');
if (
normalizedPath === '/works/detail' ||
normalizedPath === '/gallery/puzzle/detail' ||
normalizedPath === '/gallery/visual-novel/detail'
) {
return {
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
};
}
return resolveRuntimeNotFoundRecoveryAction(pathname);
}