删掉会话投影里无人使用的 generateCode 包装
src/view/ui-editor/useUiEditorPage.ts 移除 save.generateCode 及其实现:全仓只有 saveAndGenerateCode 与 stateStore.generateCode 有消费者,这个包装失败时静默返回 null,留着容易让后续调用方拿到没有原因的 null
This commit is contained in:
@@ -1367,31 +1367,6 @@ export function useUiEditorSession(
|
||||
}
|
||||
}
|
||||
|
||||
async function generateCode() {
|
||||
if (
|
||||
!resourceId ||
|
||||
isGenerating ||
|
||||
isSaving ||
|
||||
isLoading ||
|
||||
isAiRunning ||
|
||||
loadError ||
|
||||
persistedRevision === null ||
|
||||
editor.isLocked
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
setIsGenerating(true);
|
||||
try {
|
||||
return await editor.runWithStateLocked(() =>
|
||||
stateStore.generateCode(resourceId),
|
||||
);
|
||||
} catch {
|
||||
return null;
|
||||
} finally {
|
||||
setIsGenerating(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAndGenerateCode() {
|
||||
if (
|
||||
!resourceId ||
|
||||
@@ -1630,7 +1605,6 @@ export function useUiEditorSession(
|
||||
hasWarnings: () => postCheckIssuesForSave(editor.state).length > 0,
|
||||
warnings: () => postCheckIssuesForSave(editor.state),
|
||||
save,
|
||||
generateCode,
|
||||
saveAndGenerateCode,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user