Skip to content

eng-1922-downgrade-react-globally#1234

Draft
maparent wants to merge 7 commits into
mainfrom
eng-1992-downgrade-react-globally
Draft

eng-1922-downgrade-react-globally#1234
maparent wants to merge 7 commits into
mainfrom
eng-1992-downgrade-react-globally

Conversation

@maparent

Copy link
Copy Markdown
Collaborator

Another approach to the same problem: Use React 18 everywhere.
Requires a small patch to nextra-theme-docs, due to a known bug:
shuding/nextra#5007

trangdoan982 and others added 5 commits July 12, 2026 18:38
React 19's react-dom bundles createElement("script") from its hoistable
resource/preload APIs, which trips the Obsidian community-plugin store's
automated review (flagged in ENG-1988). Pin the Obsidian app to React 18.2.0
to remove the pattern.

- Set catalog:obsidian react/react-dom to 18.2.0 (matching catalog:roam so
  both apps dedupe to a single React copy). tldraw@3.14.2 peer-accepts ^18.
- Widen two manually-assigned refs to useRef<T | null>(null); React 18 types
  make RefObject.current read-only otherwise.

Verified: rebuilt dist/main.js has 0 createElement("script") occurrences
(was 3) and carries React 18.2.0; check-types and Obsidian lint pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes packages/ui type-check break from the previous commit. The workspace
shares a single hoisted @types/react; changing obsidian's @types to 18 flipped
that global slot, leaking React 18 types into type-less deps (lucide-react,
sonner) consumed by React 19 packages/ui.

Only the runtime react/react-dom (which the bundle depends on) needs to be 18.2.0
to remove createElement("script"). @types stay on ^19 as before, so the hoist
slot is unchanged and packages/ui is untouched. Reverts the now-unneeded useRef
typing change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With obsidian on react 18.2.0 and website/ui on 19, pnpm hoisted a single
react into the shared .pnpm store, and the version it picked flipped to 18.
Vercel's pruned website-only build then dangled on .pnpm/node_modules/react
(18.2.0 not in its graph) -> ENOENT.

Exclude react/react-dom from hoisting so no shared bare copy exists; every
package resolves its own anchored react via its declared dep/peer. Verified:
full check-types 8/8, obsidian bundle has 0 createElement("script") and React
18.2.0, website builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Testing showed hoistPattern was unnecessary (the website builds cleanly with
react@18 hoisted) and it could not fix the Vercel failure anyway: it only
applies on a clean node_modules, and Vercel reuses a cached one. The Vercel
red is build-cache staleness from the react 19->18 transition, not a code
issue, and is resolved by a clean install rather than a workspace change.

Net change is now just catalog:obsidian react/react-dom -> 18.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

ENG-1922

ENG-1992

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jul 15, 2026 4:33pm

Request Review

@supabase

supabase Bot commented Jul 15, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Base automatically changed from eng-1992-downgrade-obsidian-react-version-to-18 to main July 20, 2026 20:14
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.

2 participants