fix: notebook
This commit is contained in:
@@ -50,10 +50,9 @@ export const createEditSessionSlice: StateCreator<
|
|||||||
if (getEditorOpening()) return;
|
if (getEditorOpening()) return;
|
||||||
setEditorOpening(true);
|
setEditorOpening(true);
|
||||||
const api = requireApi();
|
const api = requireApi();
|
||||||
const requestId = getEditorOpenRequest() + 1;
|
// bump 模块级 _editorOpenRequest,捕获本次请求 id 用于 stale 检测
|
||||||
// 记录本次请求的 id (供 requestIsCurrent 校验)。
|
// (如果后续 openScriptEditor / endEditing 又 bump 了,本请求就算过期)。
|
||||||
// 原版用模块级 _editorOpenRequest 配合闭包变量;现在 requestIsCurrent
|
const requestId = bumpEditorOpenRequest();
|
||||||
// 通过 helpers 读取最新的模块级值 + getSelectedId()。
|
|
||||||
const requestIsCurrent = () =>
|
const requestIsCurrent = () =>
|
||||||
getEditorOpenRequest() === requestId &&
|
getEditorOpenRequest() === requestId &&
|
||||||
getSelectedId() === script.script_id;
|
getSelectedId() === script.script_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user