preactjs/signals

installAutoSignalTracking fails with React 19

Closed this issue · 3 comments

  • Check if updating to the latest version resolves the issue

Environment

  • I am using @preact/signals-core
  • I am using @preact/signals
  • I am using @preact/signals-react

Describe the bug
If you call

import { installAutoSignalTracking } from '@preact/signals-react/runtime';
installAutoSignalTracking();

when using

react@19.0.0-rc-3563387fe3-20240621
react-dom@19.0.0-rc-3563387fe3-20240621

it fails with

TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')

in addition to complaining about the peer dependency (react@"^16.14.0 || 17.x || 18.x") not including 19.x

To Reproduce
Please provide a link to a StackBlitz/CodeSandbox/Codepen project or a GitHub repository that demonstrates the issue.

Steps to reproduce the behavior:

  1. Open the app

Expected behavior
No error

in addition to complaining about the peer dependency (react@"^16.14.0 || 17.x || 18.x") not including 19.x

Not sure I'd call this a bug; you're ignoring that the package says it doesn't support 19.x.

Edit: have you tried the Babel plugin or the useSignals() hooks by chance? The runtime isn't necessarily intended to be used forever, from my understanding; it's more of a stop-gap solution.

Not sure I'd call this a bug, you're specifically using a version we don't have support for.

No, that's not a big deal and time will solve it. Seems like even a range like 18.x || >19.0.0-rc would not solve that as https://semver.npmjs.com/ says this does not match any rc version when "18.x ||" is present.

Edit: have you tried the Babel plugin or the useSignals() hooks by chance? The runtime isn't necessarily intended to be used forever, from my understanding; it's more of a stop-gap solution.

I hear we tried that and had some unspecific issues but I don't have all the details. Will go back and try it again as I understand that should not be (so much) dependent on the React version

@Artur- yep, version powered by babel is more reliable, because it does not patch react internals