diff --git a/frontend/app/features/platform/state/editSessionSlice.ts b/frontend/app/features/platform/state/editSessionSlice.ts index 7751d77..376c80d 100644 --- a/frontend/app/features/platform/state/editSessionSlice.ts +++ b/frontend/app/features/platform/state/editSessionSlice.ts @@ -50,10 +50,9 @@ export const createEditSessionSlice: StateCreator< if (getEditorOpening()) return; setEditorOpening(true); const api = requireApi(); - const requestId = getEditorOpenRequest() + 1; - // 记录本次请求的 id (供 requestIsCurrent 校验)。 - // 原版用模块级 _editorOpenRequest 配合闭包变量;现在 requestIsCurrent - // 通过 helpers 读取最新的模块级值 + getSelectedId()。 + // bump 模块级 _editorOpenRequest,捕获本次请求 id 用于 stale 检测 + // (如果后续 openScriptEditor / endEditing 又 bump 了,本请求就算过期)。 + const requestId = bumpEditorOpenRequest(); const requestIsCurrent = () => getEditorOpenRequest() === requestId && getSelectedId() === script.script_id;