Merge pull request #363 from AutoMaker-Org/fix/app-spec-ui-bug

fix: prevent 'No App Specification Found' during spec generation
This commit is contained in:
Shirone
2026-01-05 16:04:26 +01:00
committed by GitHub
2 changed files with 28 additions and 6 deletions

View File

@@ -14,7 +14,7 @@ export function SpecView() {
const { currentProject, appSpec } = useAppStore(); const { currentProject, appSpec } = useAppStore();
// Loading state // Loading state
const { isLoading, specExists, loadSpec } = useSpecLoading(); const { isLoading, specExists, isGenerationRunning, loadSpec } = useSpecLoading();
// Save state // Save state
const { isSaving, hasChanges, saveSpec, handleChange, setHasChanges } = useSpecSave(); const { isSaving, hasChanges, saveSpec, handleChange, setHasChanges } = useSpecSave();
@@ -82,15 +82,20 @@ export function SpecView() {
); );
} }
// Empty state - no spec exists // Empty state - no spec exists or generation is running
if (!specExists) { // When generation is running, we skip loading the spec to avoid 500 errors,
// so we show the empty state with generation indicator
if (!specExists || isGenerationRunning) {
// If generation is running (from loading hook check), ensure we show the generating UI
const showAsGenerating = isCreating || isGenerationRunning;
return ( return (
<> <>
<SpecEmptyState <SpecEmptyState
projectPath={currentProject.path} projectPath={currentProject.path}
isCreating={isCreating} isCreating={showAsGenerating}
isRegenerating={isRegenerating} isRegenerating={isRegenerating || isGenerationRunning}
currentPhase={currentPhase} currentPhase={currentPhase || (isGenerationRunning ? 'initialization' : '')}
errorMessage={errorMessage} errorMessage={errorMessage}
onCreateClick={() => setShowCreateDialog(true)} onCreateClick={() => setShowCreateDialog(true)}
/> />

View File

@@ -9,6 +9,7 @@ export function useSpecLoading() {
const { currentProject, setAppSpec } = useAppStore(); const { currentProject, setAppSpec } = useAppStore();
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [specExists, setSpecExists] = useState(true); const [specExists, setSpecExists] = useState(true);
const [isGenerationRunning, setIsGenerationRunning] = useState(false);
const loadSpec = useCallback(async () => { const loadSpec = useCallback(async () => {
if (!currentProject) return; if (!currentProject) return;
@@ -16,6 +17,21 @@ export function useSpecLoading() {
setIsLoading(true); setIsLoading(true);
try { try {
const api = getElectronAPI(); const api = getElectronAPI();
// Check if spec generation is running before trying to load
// This prevents showing "No App Specification Found" during generation
if (api.specRegeneration) {
const status = await api.specRegeneration.status();
if (status.success && status.isRunning) {
logger.debug('Spec generation is running, skipping load');
setIsGenerationRunning(true);
setIsLoading(false);
return;
}
}
// Always reset when generation is not running (handles edge case where api.specRegeneration might not be available)
setIsGenerationRunning(false);
const result = await api.readFile(`${currentProject.path}/.automaker/app_spec.txt`); const result = await api.readFile(`${currentProject.path}/.automaker/app_spec.txt`);
if (result.success && result.content) { if (result.success && result.content) {
@@ -42,6 +58,7 @@ export function useSpecLoading() {
isLoading, isLoading,
specExists, specExists,
setSpecExists, setSpecExists,
isGenerationRunning,
loadSpec, loadSpec,
}; };
} }