Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate "use-sync-external-store" as it doesn't play nice with React 19? #332

Open
XavierGeerinck opened this issue Dec 23, 2024 · 0 comments

Comments

@XavierGeerinck
Copy link

import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js'

It seems that when transpiling this with React 19 support it provides the error

Attempted import error: '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' is not exported from 'react' (imported as 'React93').

Looking at the transpiled code (only reference to the usage of the require_use_sync_external_store_shim_development method)

// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
import * as React91 from "react";
var require_use_sync_external_store_shim_development = __commonJS((exports) => {
    // ...
    var ReactSharedInternals = React91.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    // ...

// ../../node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS((exports, module) => {
  if (false) {
  } else {
    module.exports = require_use_sync_external_store_shim_development();
  }
});

// ../../node_modules/cmdk/dist/index.mjs
import * as n56 from "react";
var import_shim = __toESM(require_shim(), 1);
...

Solution would be to not use the use-sync-external-store module, which only seems to be used in https://github.com/pacocoursey/cmdk/blob/9827edf89fc663e24188f9d715a0dca01a736d6d/cmdk/src/index.tsx

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

No branches or pull requests

1 participant