移除无读取的代码生成错误状态
删除失效的 generateError 状态及写入路径
This commit is contained in:
@@ -200,7 +200,6 @@ export function useUiEditorSession(
|
||||
);
|
||||
const [saveError, setSaveError] = useState<string | null>(null);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [generateError, setGenerateError] = useState<string | null>(null);
|
||||
const [isGenerating, setIsGenerating] = useState(false);
|
||||
const normalizedInitialStepIndex =
|
||||
initialStep === 'reference-analysis'
|
||||
@@ -300,7 +299,6 @@ export function useUiEditorSession(
|
||||
setPersistedRevision(0);
|
||||
setSavedStateSignature(JSON.stringify(EMPTY_UI_EDITOR_STATE));
|
||||
setSaveError(null);
|
||||
setGenerateError(null);
|
||||
setIsGenerating(false);
|
||||
setHiddenNodeIds(new Set());
|
||||
return;
|
||||
@@ -311,7 +309,6 @@ export function useUiEditorSession(
|
||||
setLoadError(null);
|
||||
setPersistedRevision(null);
|
||||
setSaveError(null);
|
||||
setGenerateError(null);
|
||||
setIsGenerating(false);
|
||||
void stateStore
|
||||
.load(resourceId)
|
||||
@@ -1427,7 +1424,6 @@ export function useUiEditorSession(
|
||||
};
|
||||
}
|
||||
setSaveError(null);
|
||||
setGenerateError(null);
|
||||
setIsSaving(true);
|
||||
try {
|
||||
return await editor.runWithStateLocked(async (snapshot) => {
|
||||
@@ -1475,17 +1471,14 @@ export function useUiEditorSession(
|
||||
persistedRevision === null ||
|
||||
editor.isLocked
|
||||
) {
|
||||
setGenerateError('当前状态不允许生成代码,请稍后重试。');
|
||||
return null;
|
||||
}
|
||||
setGenerateError(null);
|
||||
setIsGenerating(true);
|
||||
try {
|
||||
return await editor.runWithStateLocked(() =>
|
||||
stateStore.generateCode(resourceId),
|
||||
);
|
||||
} catch (cause) {
|
||||
setGenerateError(cause instanceof Error ? cause.message : String(cause));
|
||||
} catch {
|
||||
return null;
|
||||
} finally {
|
||||
setIsGenerating(false);
|
||||
@@ -1510,7 +1503,6 @@ export function useUiEditorSession(
|
||||
};
|
||||
}
|
||||
setSaveError(null);
|
||||
setGenerateError(null);
|
||||
setIsSaving(true);
|
||||
setIsGenerating(true);
|
||||
try {
|
||||
@@ -1548,7 +1540,6 @@ export function useUiEditorSession(
|
||||
} catch (cause) {
|
||||
const message =
|
||||
cause instanceof Error ? cause.message : String(cause);
|
||||
setGenerateError(message);
|
||||
return {
|
||||
status: 'failed' as const,
|
||||
phase: 'generate' as const,
|
||||
@@ -1744,7 +1735,6 @@ export function useUiEditorSession(
|
||||
isDirty,
|
||||
saveError,
|
||||
isGenerating,
|
||||
generateError,
|
||||
hasWarnings: () => postCheckIssuesForSave(editor.state).length > 0,
|
||||
warnings: () => postCheckIssuesForSave(editor.state),
|
||||
save,
|
||||
|
||||
Reference in New Issue
Block a user