Skip to content

fix: unblock fresh-clone editor boot#683

Merged
softmarshmallow merged 1 commit intomainfrom
feature/brave-pike-341844
Apr 22, 2026
Merged

fix: unblock fresh-clone editor boot#683
softmarshmallow merged 1 commit intomainfrom
feature/brave-pike-341844

Conversation

@softmarshmallow
Copy link
Copy Markdown
Member

@softmarshmallow softmarshmallow commented Apr 22, 2026

Summary

I ran through a fresh-worktree setup of the editor and hit three things that block any contributor's first click after pnpm install && pnpm dev:editor. Fixing them here, plus the two doc mismatches I tripped on.

What changed

/canvas now boots on a clean clone

editor/grida-canvas/backends/wasm-locate-file.ts hardcoded http://localhost:4020/dist/ as the dev fallback. That URL is only served by just serve canvas wasm after just build canvas wasm — which pulls emsdk, requires ninja, and takes ~10 min on first run. Result: a fresh checkout's /canvas loaded a progress bar forever with no UI error, no console error, no 404 (I only found the URL via performance.getEntriesByType('resource')).

Now: in dev, if NEXT_PUBLIC_GRIDA_WASM_DEV_SERVE_URL is set, use it; otherwise fall through to the unpkg-published wasm (same path prod already uses). Canvas-engine devs who want local wasm still set the env var — .env.example now has it commented out and labeled as an opt-in override.

Landing page no longer throws on every load

Two separate bugs, both on /:

  • FullscreenLoadingOverlay in grida-canvas-react-starter-kit/starterkit-loading/loading.tsx:204 had startTime in the effect's dep array while also being set inside the effect — infinite setState-in-useEffect loop, showing up as Maximum update depth exceeded on every home render. Switched startTime to useRef; semantics preserved (latch on enter, read on exit).
  • content-1.tsx (the carousel on the home page) spread a StaticImageData import via {...img} before the carousel had picked an index, rendering <Image src={undefined} /> on first paint (empty-src + "Image missing required src" warnings), and then leaked blurWidth/blurHeight DOM attrs ("React does not recognize the blurWidth prop" warnings). Guarded the initial render and pass src={img} so Next owns the blur bookkeeping.

Docs

  • README.md: Node 22+24+ to match .nvmrc (v24.14.0) and engines.node (>=24.0.0).
  • CONTRIBUTING.md: the submodule clone step was labeled "optional" but it's required for any canvas/WASM build (third_party/externals/emsdk). Reworded, added the git submodule update --init recovery command for folks who already cloned without --recurse-submodules.

Verification

  • pnpm turbo typecheck --filter=editor → 28/28 pass (editor rebuilt, not cached).
  • pnpm oxlint on all changed TS → 0 warnings, 0 errors.
  • Runtime: booted the editor fresh, loaded / (no red overlay, 0 errors in console), loaded /canvas and confirmed the wasm fetch URL is now https://unpkg.com/@grida/canvas-wasm@<ver>/dist/grida_canvas_wasm.wasm and the editor UI renders fully without any local rust/emsdk toolchain.

Reviewer notes

  • The wasm-locate-file change is behavior-preserving for anyone whose .env already sets NEXT_PUBLIC_GRIDA_WASM_DEV_SERVE_URL (the shipped example did). The only change-in-behavior case is a dev who had the var unset — they now get the published wasm in dev instead of a 404.
  • Not fixed here (out of scope):
    • The Turbopack "multiple lockfiles" warning is worktree-specific and doesn't fire on a normal clone.
    • /playground/canvas isn't a real route (the Canvas Playground card on /playground links to /canvas) — no code or docs referenced the phantom path.

Test plan

  • On a fresh clone: pnpm install && cp editor/.env.example editor/.env && pnpm dev:editor, open / (no red overlay, clean console) and /canvas (editor loads with wasm from unpkg, no local build needed).
  • With NEXT_PUBLIC_GRIDA_WASM_DEV_SERVE_URL=http://localhost:4020/dist set and just serve canvas wasm running, /canvas still loads the locally served wasm.

Summary by CodeRabbit

  • Documentation

    • Updated contribution guidelines with required submodule cloning instructions for canvas/WASM builds
    • Updated minimum Node.js version requirement to 24+ in system requirements
  • Bug Fixes

    • Fixed conditional image rendering on home page
  • Chores

    • Updated WASM development server configuration defaults
    • Optimized loading overlay rendering performance to reduce unnecessary updates

Findings from a fresh-worktree dry run. Contributors running
`pnpm install && pnpm dev:editor` on a clean checkout hit three issues
before they can click anything:

- `/canvas` hangs on a spinner forever. `wasm-locate-file.ts` hardcodes
  `http://localhost:4020/dist/` as the dev fallback, which is only served
  after `just build canvas wasm` (emsdk, ninja, ~10 min first build).
  Let dev mode fall through to the unpkg-published wasm when the opt-in
  env var is unset; comment the var out in `.env.example` so it's off by
  default and labeled as an override for canvas-engine work.
- The landing page throws `Maximum update depth exceeded` on every load
  from `FullscreenLoadingOverlay`. `startTime` was a `useState` listed in
  the effect's dep array while also being set inside the effect — classic
  loop. Switch to `useRef`; semantics preserved (latch on enter, read on
  exit).
- The landing page also logs empty-`src` / `blurWidth`/`blurHeight` DOM
  warnings on first paint. `BigImageContainer` was spreading a
  `StaticImageData` import via `{...img}` before the carousel picked an
  index, then again into `<Image>` leaking blur bookkeeping to the DOM.
  Guard the initial render and pass the static import as `src={img}`.

Docs: README Node version bumped 22 -> 24 to match `.nvmrc` / engines,
and CONTRIBUTING clarifies the submodule step is required (not optional)
with the `git submodule update --init` recovery.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Apr 22, 2026 3:14pm
docs Ready Ready Preview, Comment Apr 22, 2026 3:14pm
grida Ready Ready Preview, Comment Apr 22, 2026 3:14pm
viewer Ready Ready Preview, Comment Apr 22, 2026 3:14pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
backgrounds Ignored Ignored Preview Apr 22, 2026 3:14pm
code Ignored Ignored Apr 22, 2026 3:14pm
legacy Ignored Ignored Apr 22, 2026 3:14pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Walkthrough

This pull request updates documentation (Node.js requirement and git clone instructions), modifies environment configuration for WASM builds, adjusts component prop interfaces, optimizes a loading overlay to prevent re-renders, and removes a development-mode fallback path for WASM locating.

Changes

Cohort / File(s) Summary
Documentation
CONTRIBUTING.md, README.md
Updated git submodule cloning guidance from optional to required for canvas/WASM builds; updated Node.js version requirement from 22+ to 24+.
Configuration
editor/.env.example
Commented out NEXT_PUBLIC_GRIDA_WASM_DEV_SERVE_URL to make it opt-in; updated instructions to clarify local WASM serving requires explicit build steps.
Component Changes
editor/app/(www)/(home)/_home/content-1.tsx
Content1 now conditionally renders BigImageContainer only when img exists; BigImageContainer removed width and height from prop interface and no longer forwards them to underlying Image.
Performance Optimization
editor/grida-canvas-react-starter-kit/starterkit-loading/loading.tsx
Replaced startTime state with startTimeRef to eliminate re-renders; overlay minimum-display logic now reads from ref instead of state.
Dev/Prod Routing
editor/grida-canvas/backends/wasm-locate-file.ts
Removed development-mode fallback to localhost:4020; function now always returns production CDN URL when NEXT_PUBLIC_GRIDA_WASM_DEV_SERVE_URL is unset.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

org

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the pull request, which is to unblock fresh-clone editor boot by resolving dev-time fallback issues and doc updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/brave-pike-341844

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
CONTRIBUTING.md (1)

149-149: ⚠️ Potential issue | 🟡 Minor

Fix typo to unblock the typos CI job.

Pipeline reports recommeded at Line 149; change it to recommended.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CONTRIBUTING.md` at line 149, Fix the typo "recommeded" to "recommended" in
the CONTRIBUTING.md content (the misspelled token "recommeded" at the reported
location); update that single word so the typos CI job passes and commit the
change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@CONTRIBUTING.md`:
- Line 149: Fix the typo "recommeded" to "recommended" in the CONTRIBUTING.md
content (the misspelled token "recommeded" at the reported location); update
that single word so the typos CI job passes and commit the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a84cbfca-b1d0-41f2-b29f-757d6b281b73

📥 Commits

Reviewing files that changed from the base of the PR and between 3917d43 and bf75dbd.

📒 Files selected for processing (6)
  • CONTRIBUTING.md
  • README.md
  • editor/.env.example
  • editor/app/(www)/(home)/_home/content-1.tsx
  • editor/grida-canvas-react-starter-kit/starterkit-loading/loading.tsx
  • editor/grida-canvas/backends/wasm-locate-file.ts
💤 Files with no reviewable changes (1)
  • editor/grida-canvas/backends/wasm-locate-file.ts

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