Skip to content

fix(embed): explicit loading states until model is displayed - #736

Merged
w1ne merged 2 commits into
developfrom
fix/embed-loading-states
Sep 19, 2026
Merged

w1ne merged 2 commits into
developfrom
fix/embed-loading-states

Conversation

@w1ne

@w1ne w1ne commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause (embed half): /embed/$slug set ready as soon as source downloaded, so ChatGPT’s Studio viewer iframe looked “done” while geometry was still building (or failed) — empty canvas.
  • FunnelViewer now reports phases: building geometry → loading mesh → model displayed / build failed / viewer failed.
  • DisplayReadySensor only fires after nonempty geometry + camera fit window + submitted frames (iframe load is not enough).
  • Embed keeps a visible status (and Retry on failure) until the model is displayed.
  • Optional ?meshUrl= + FunnelViewer meshUrl prop scaffold Phase 3 artifact loading (still executes source today).

Pairs with server PR: https://github.com/w1ne/kernelCAD-server/pull/129

Test plan

  • DisplayReadySensor nonempty geometry unit tests
  • Existing embed config tests still pass
  • Manual desktop: open /embed/<slug> — status progresses; never leaves empty canvas as complete
  • Manual: force a bad script — shows Build failed + Retry
  • Manual Android ChatGPT iframe after server deploy — model appears without a second user message

Phase 3

Design note: docs/phase3-versioned-mesh-artifact.md. Full evaluate-once artifact pipeline left for a follow-up (keep OCCT mutex).

Embed marked ready as soon as project source arrived, so ChatGPT iframes
showed an empty canvas. Track Project saved → Building geometry → Loading
mesh → Model displayed (or Build/Viewer failed + Retry). FunnelViewer reports
phases; DisplayReadySensor requires nonempty geometry, camera fit, and a
submitted frame. Optional ?meshUrl= hooks Phase 3 artifacts.
react-refresh/only-export-components failed because DisplayReadySensor.tsx
exported both the helper and the component. Move the helper to its own
module and keep FunnelViewer/tests importing from there.

react-hooks/refs failed on assigning onReadyRef.current during render;
sync the callback via useEffect, matching useParamUpdate.

Signed-off-by: Andrii Shylenko <14119286+w1ne@users.noreply.github.com>
@w1ne
w1ne merged commit 2dddc38 into develop Sep 19, 2026
15 checks passed
@w1ne
w1ne deleted the fix/embed-loading-states branch September 19, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant