preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.62k stars 88 forks source link

When will react19 be supported? #566

Closed lyboy2012 closed 1 month ago

lyboy2012 commented 1 month ago

Describe the feature you'd love to see A clear and concise description of what you'd love to see added to Preact Signals.

Additional context (optional) Add any other context or screenshots about the feature request here.

rschristian commented 1 month ago

What exactly isn't working?

React 19 hasn't even been released yet FWIW.

XantreDev commented 1 month ago

Signals will work with react 19, but probably will not with react compiler

lyboy2012 commented 1 month ago

What exactly isn't working?

React 19 hasn't even been released yet FWIW.

`resolve 'react' in '/Users/liying/workspace/code/car/carminiapp/node_modules/@preact/signals-react/runtime/dist' Parsed request is a module using description file: /Users/liying/workspace/code/car/carminiapp/node_modules/@preact/signals-react/runtime/package.json (relative path: ./dist) aliased with mapping 'react': '/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js' to '/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js' using description file: /Users/liying/workspace/code/car/carminiapp/node_modules/@preact/signals-react/runtime/package.json (relative path: ./dist) Field 'browser' doesn't contain a valid alias configuration root path /Users/liying/workspace/code/car/carminiapp using description file: /Users/liying/workspace/code/car/carminiapp/package.json (relative path: ./Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js) no extension Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.jsx doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.ts doesn't exist .tsx Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.tsx doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.mjs doesn't exist .vue Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.vue doesn't exist as directory /Users/liying/workspace/code/car/carminiapp/Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js doesn't exist using description file: /Users/liying/workspace/code/car/carminiapp/node_modules/react/package.json (relative path: ./cjs/react.production.min.js) no extension Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.jsx doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.ts doesn't exist .tsx Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.tsx doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.mjs doesn't exist .vue Field 'browser' doesn't contain a valid alias configuration /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js.vue doesn't exist as directory /Users/liying/workspace/code/car/carminiapp/node_modules/react/cjs/react.production.min.js doesn't exist

→ Watching... [2024/5/24 15:25:19]

node:internal/process/promises:289 triggerUncaughtException(err, true / fromPromise /); ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "[object Array]".] { code: 'ERR_UNHANDLED_REJECTION' } `

rschristian commented 1 month ago

That doesn't look to be even remotely related to this repo

lyboy2012 commented 1 month ago

That doesn't look to be even remotely related to this repo

yes, when upgraded to 19 has error,I don't know why,react 18.3.1 is work

rschristian commented 1 month ago

Can you provide a minimal reproduction? Looks like a module resolution/bundler issue.

lyboy2012 commented 1 month ago

Can you provide a minimal reproduction? Looks like a module resolution/bundler issue.

Thank you. Wait a minute

XantreDev commented 1 month ago

Your error looks more like a bundler error after updating react. I am not sure that signals make the difference

lyboy2012 commented 1 month ago

Your error looks more like a bundler error after updating react. I am not sure that signals make the difference

Yes, this is miniapp project is not a web project,I'll check myself,thank you @XantreDev @rschristian !

willwillems commented 2 weeks ago

Signals will work with react 19, but probably will not with react compiler

Is there no interest long-term to make them work with the React compiler or just not right now when it's still unstable?

rschristian commented 2 weeks ago

I wouldn't say there no interest, or that it probably wouldn't work, but I don't think we're going to maintain a fork of the compiler to add in additional logic for signals as this would be a pretty big effort. Support I believe will depend on whether it breaks signals; if not, then great! If it does, I'm not sure what we can reasonably do.

willwillems commented 2 weeks ago

For other people running into this issue, the current version of React 19 with the compiler enabled works wonderfully with signals and module:@preact/signals-react-transform, no need to manually use @preact/signals-react/runtime.

If you're not getting the reactivity you're expecting you're likely messing something else up, as was I (incorrectly structured @vitejs/plugin-react config).

Make sure you include "module:@preact/signals-react-transform" after "babel-plugin-react-compiler" and you should be good.