Merge remote-tracking branch 'origin/master' into hermes/hermes-1e775b03
Some checks failed
CI / verify (pull_request) Has been cancelled
Some checks failed
CI / verify (pull_request) Has been cancelled
# Conflicts: # docs/technical/README.md # src/components/custom-world-home/CustomWorldCreationHub.tsx # src/components/custom-world-home/creationWorkShelf.ts # src/components/platform-entry/PlatformEntryFlowShellImpl.tsx # src/components/rpg-entry/RpgEntryFlowShell.agent.interaction.test.tsx
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { expect, test } from 'vitest';
|
||||
|
||||
import { resolveRuntimeNotFoundRecoveryAction } from './runtimeNotFoundRecovery';
|
||||
import {
|
||||
resolveRuntimeNotFoundRecoveryAction,
|
||||
resolveWorkNotFoundRecoveryAction,
|
||||
} from './runtimeNotFoundRecovery';
|
||||
|
||||
test('runtime not found recovery returns home after direct runtime route alert', () => {
|
||||
expect(resolveRuntimeNotFoundRecoveryAction('/runtime/puzzle')).toEqual({
|
||||
@@ -19,3 +22,21 @@ test('runtime not found recovery only handles direct runtime routes', () => {
|
||||
expect(resolveRuntimeNotFoundRecoveryAction('/gallery/puzzle/detail')).toBeNull();
|
||||
expect(resolveRuntimeNotFoundRecoveryAction('/creation/puzzle/result')).toBeNull();
|
||||
});
|
||||
|
||||
test('work not found recovery returns home for direct public detail routes', () => {
|
||||
expect(resolveWorkNotFoundRecoveryAction('/works/detail')).toEqual({
|
||||
nextStage: 'platform',
|
||||
nextPath: '/',
|
||||
shouldAlert: true,
|
||||
});
|
||||
expect(resolveWorkNotFoundRecoveryAction('/works/detail/')).toEqual({
|
||||
nextStage: 'platform',
|
||||
nextPath: '/',
|
||||
shouldAlert: true,
|
||||
});
|
||||
expect(resolveWorkNotFoundRecoveryAction('/gallery/puzzle/detail')).toEqual({
|
||||
nextStage: 'platform',
|
||||
nextPath: '/',
|
||||
shouldAlert: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user