Skip to content

refactor: Extract Monaco/Sandpack as DOM components, add RN stubs#3

Closed
BrandeisPatrick wants to merge 1 commit into
productionfrom
refactor/dom-components
Closed

refactor: Extract Monaco/Sandpack as DOM components, add RN stubs#3
BrandeisPatrick wants to merge 1 commit into
productionfrom
refactor/dom-components

Conversation

@BrandeisPatrick

Copy link
Copy Markdown
Owner

Summary

  • Extract Monaco editor into src/components/dom/MonacoEditor.jsx with the "use dom" directive. EditorPanel now consumes it. On web the directive is a no-op and behavior is unchanged; on native it lets the editor render inside a WebView via Expo DOM Components.
  • Extract Sandpack provider + layout + error listener into src/components/dom/SandpackPreview.jsx with "use dom". LiveReactEditor now consumes it (web-only CDN check, controls, and loading wrapper stay put).
  • Add Metro-picked .native.js stubs so shared code can compile on React Native without crashing at bundle time: src/config/firebase.native.js, src/hooks/useIsMobile.native.js, src/hooks/useVirtualKeyboard.native.js.

This is Phase 0 of the iOS-first pivot (see ~/.claude/plans/we-want-to-make-partitioned-goblet.md). The actual iOS app lives on the long-lived mobile branch; this PR only lands the shared-code refactor that both web and iOS benefit from.

Test plan

  • npm run build passes on web
  • npm run lint — no new errors introduced (pre-existing EditorPanel.jsx:17 set-state-in-effect is unchanged)
  • Smoke-test web in browser: Monaco editor opens, file tabs work, content renders identically to before
  • Smoke-test web in browser: Sandpack preview loads, error bubbling to the debug flow still works
  • No runtime regressions reported after deploy

🤖 Generated with Claude Code

Prepares the codebase for the upcoming iOS app (Expo + DOM Components):

- Extract Monaco editor into src/components/dom/MonacoEditor.jsx with
  the "use dom" directive so it can render inside a WebView on native
  while behaving identically on web. EditorPanel now consumes it.
- Extract Sandpack provider + layout + error listener into
  src/components/dom/SandpackPreview.jsx with "use dom". LiveReactEditor
  now consumes it (the web-only CDN check, controls, and loading wrapper
  stay put).
- Add Metro-picked .native.js stubs so shared code can compile on
  React Native without crashing at bundle time:
    - src/config/firebase.native.js (throws clearly until Phase 1 wires
      @react-native-firebase/*)
    - src/hooks/useIsMobile.native.js (returns true on RN)
    - src/hooks/useVirtualKeyboard.native.js (placeholder shape; Phase 1
      will use react-native Keyboard events)

Web runtime behavior is unchanged; npm run build still passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
blank-space Ready Ready Preview, Comment Apr 22, 2026 3:32pm

@BrandeisPatrick

Copy link
Copy Markdown
Owner Author

Closing per team decision to keep mobile and production branches separate — the DOM extraction stays on the mobile branch only, production stays untouched.

@BrandeisPatrick BrandeisPatrick deleted the refactor/dom-components branch April 22, 2026 15:34
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