fix: move to step 4 immediately so user can see meshy progress bar during polling
Build and Deploy / build-and-push (push) Successful in 38s

This commit is contained in:
AI Bot
2026-09-02 15:23:51 +05:30
parent ad6a28ea0e
commit 276da43d28
+8 -2
View File
@@ -109,9 +109,13 @@ export default function SparkPlug() {
setIsLoading(false); setIsLoading(false);
return; return;
} }
// Call backend to start Meshy task // Call backend to start Meshy task
const taskId = await api.generate3D(generatedImages); const taskId = await api.generate3D(generatedImages);
// Immediately move to step 4 to show the progress bar
setCurrentStep(4);
// Poll Meshy status // Poll Meshy status
let isDone = false; let isDone = false;
let attempts = 0; let attempts = 0;
@@ -129,7 +133,7 @@ export default function SparkPlug() {
if (status === 'SUCCEEDED') { if (status === 'SUCCEEDED') {
setGeneratedGlbUrl(model_urls.glb); setGeneratedGlbUrl(model_urls.glb);
isDone = true; isDone = true;
setCurrentStep(4); // The step is already 4, user just clicks "Open in Editor" when progress >= 100
} else if (status === 'FAILED') { } else if (status === 'FAILED') {
throw new Error(`Meshy generation failed: ${task_error?.message || 'Unknown error'}`); throw new Error(`Meshy generation failed: ${task_error?.message || 'Unknown error'}`);
} }
@@ -141,7 +145,9 @@ export default function SparkPlug() {
} catch (err: any) { } catch (err: any) {
console.error(err); console.error(err);
alert(`Failed to generate 3D model: ${err.message || 'Unknown error'}`); alert(`Failed to construct 3D model: ${err.message || 'Unknown error'}`);
// If it fails, revert back to step 3 so they can try again
setCurrentStep(3);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }