Repository navigation
fix(core): silence React 19 external store warning - #1644
Conversation
🦋 Changeset detectedLatest commit: f9a5c78 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This is a focused, well-scoped bug fix. The approach is correct: rather than aliasing use-sync-external-store/shim to the package main entry (which logs a React 18+/19 dev warning because it too is a shim path), it routes both known shim entry points to a tiny EmDash virtual ESM module that re-exports useSyncExternalStore directly from react. Since React is EmDash's peer-dep floor, this is the idiomatic React 18+ resolution and preserves the prior CJS workaround that keeps hydration from breaking with pnpm's virtual store.
I checked the virtual module wiring (resolveId and load both updated), the Vite alias ordering (more-specific /shim/index.js still precedes /shim), the optimizeDeps.exclude coverage for virtual:emdash, the peer dependency range (react >= 18.0.0), the updated tests, and the changeset. The implementation is clean, the existing test pattern is followed, and the changeset is user-facing and appropriate. No AGENTS.md conventions are violated: no UI strings changed, no database code touched, no SQL, no route authorization changes.
724f38f to
f9a5c78
Compare
main is at 0.24.0 in package.json with the 0.24.0 changelog written, but 0.24.0 was never published to npm: the release run that should have published it found these two changesets had raced onto main and prepared 0.24.1 instead, skipping the 0.24.0 publish. Temporarily remove the two pending changesets so the next Release run sees no changesets, makes `changeset version` a no-op, and falls through to `changeset publish` to release the already-versioned 0.24.0 (npm + tag + GitHub release + plugin tarballs). These changesets document #1646 and #1644, which belong in 0.24.1. They are restored in a follow-up PR immediately after 0.24.0 publishes, which cuts 0.24.1 with their text and attribution intact.
Restores the two changesets temporarily removed in #1651 to publish the already-versioned 0.24.0. With 0.24.0 now on npm, these belong in 0.24.1. Each carries pinned `pr:`/`commit:`/`author:` magic lines so @changesets/changelog-github credits the original PRs and authors (#1646 / @mvanhorn, #1644 / @masonjames) rather than this release PR. Without the override it would attribute to the commit that re-added the files (this PR), losing the contributors' credit.
What does this PR do?
Fixes React 19 dev-console warnings from the visual editing toolbar's transitive
use-sync-external-store/shimimports.EmDash already aliases the shim because Vite can otherwise serve the raw CJS shim from pnpm's virtual store. The remaining issue is that the shim package entry logs a warning in development on React 18+ because it only re-exports React's built-in hook.
This keeps the CJS workaround but points the shim imports, including
shim/with-selector, at small absolute ESM shim files shipped with EmDash. The absolute file paths are intentional: Vite/Rolldown dependency optimization applies aliases without EmDash's virtual module plugin, so virtual IDs can become unloadable during pre-bundling.Issue: none filed.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain. N/A: no admin UI strings changed.AI-generated code disclosure
Screenshots / test output
pnpm lint:json | jq '.diagnostics | length'->0pnpm lint:quick-> cleanpnpm typecheck-> passpnpm lint-> passpnpm format-> ranpnpm --filter emdash test -- run packages/core/tests/unit/astro/vite-config.test.ts packages/core/tests/unit/astro/integration/virtual-modules.test.ts-> passpnpm build-> passnode scripts/query-counts.mjs --target sqlite --update --skip-seed-> pass; no query-count snapshot diffNote:
pnpm testwas run afterpnpm build; all packages passed until@emdash-cms/sandbox-workerd, where the existing workerd integration test failed to bind its fixed local port127.0.0.1:18788inenforces wall-time limit. The same fixed-port failure reproduced when rerun in isolation and appears unrelated to this React/Vite alias change.