refactor: 收口创作直达恢复判定

This commit is contained in:
2026-06-04 01:43:31 +08:00
parent 75593b8860
commit 0d2d391cb2
6 changed files with 98 additions and 19 deletions

View File

@@ -158,7 +158,6 @@ import {
} from '../../services/creationEntryConfigService';
import {
clearCreationUrlState,
isCreationRestorePath,
readCreationUrlState,
writeCreationUrlState,
} from '../../services/creationUrlState';
@@ -408,9 +407,9 @@ import {
buildSquareHoleCreationUrlState,
buildVisualNovelCreationUrlState,
buildWoodenFishCreationUrlState,
hasCreationUrlStateValue,
hasPuzzleRuntimeUrlStateValue,
normalizeCreationUrlValue,
resolveInitialCreationUrlRestoreDecision,
} from './platformCreationUrlStateModel';
import { resolvePlatformCreationWorkDeleteConfirmationModel } from './platformCreationWorkDeleteFlow';
import {
@@ -12136,23 +12135,22 @@ export function PlatformEntryFlowShellImpl({
);
useEffect(() => {
if (handledInitialCreationUrlStateRef.current) {
const restoreDecision = resolveInitialCreationUrlRestoreDecision({
handled: handledInitialCreationUrlStateRef.current,
pathname: window.location.pathname,
state: initialCreationUrlState,
isLoadingPlatform: platformBootstrap.isLoadingPlatform,
canReadProtectedData: platformBootstrap.canReadProtectedData,
});
if (restoreDecision.type === 'skip' || restoreDecision.type === 'wait') {
return;
}
if (!isCreationRestorePath(window.location.pathname)) {
if (restoreDecision.type === 'mark-handled') {
handledInitialCreationUrlStateRef.current = true;
return;
}
if (!hasCreationUrlStateValue(initialCreationUrlState)) {
handledInitialCreationUrlStateRef.current = true;
return;
}
if (platformBootstrap.isLoadingPlatform) {
return;
}
if (!platformBootstrap.canReadProtectedData) {
return;
}
handledInitialCreationUrlStateRef.current = true;