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
Build and Deploy / build-and-push (push) Successful in 38s
This commit is contained in:
@@ -109,9 +109,13 @@ export default function SparkPlug() {
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Call backend to start Meshy task
|
||||
const taskId = await api.generate3D(generatedImages);
|
||||
|
||||
// Immediately move to step 4 to show the progress bar
|
||||
setCurrentStep(4);
|
||||
|
||||
// Poll Meshy status
|
||||
let isDone = false;
|
||||
let attempts = 0;
|
||||
@@ -129,7 +133,7 @@ export default function SparkPlug() {
|
||||
if (status === 'SUCCEEDED') {
|
||||
setGeneratedGlbUrl(model_urls.glb);
|
||||
isDone = true;
|
||||
setCurrentStep(4);
|
||||
// The step is already 4, user just clicks "Open in Editor" when progress >= 100
|
||||
} else if (status === 'FAILED') {
|
||||
throw new Error(`Meshy generation failed: ${task_error?.message || 'Unknown error'}`);
|
||||
}
|
||||
@@ -141,7 +145,9 @@ export default function SparkPlug() {
|
||||
|
||||
} catch (err: any) {
|
||||
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 {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user