-
-
Notifications
You must be signed in to change notification settings - Fork 113
Support signals without importing preact-hooks #718
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
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for preact-signals-demo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Size Change: +275 B (+0.31%) Total Size: 87.9 kB
ℹ️ View Unchanged
|
64c808d
to
b18697e
Compare
I imagine you mean "...do leverage hooks..." (emphasis mine), but indeed. I originally gave the feature request a thumbs up, but now that you've laid this out, I'm thinking you're right, this would just be a regression for most users. I suppose unbundled apps might get to drop an additional network request for Biggest selling point might just be the purity of the implementation but even that's pretty moot. |
Resolves #670
This is a proposal to allow us to leverage signals without the need for the Preact Hooks implementation, this should save about 1.2kb gzipped as we aren't pulling in all of the other hooks. The main thing that people might miss are
useMemo
/useCallback
- in theory we could useuseComputed
for that with.value
however now sure we want to encourage that.We could export a version of
useStoreValue
for this?Additionally,
useRef
is replaced withuseSignalRef
.In the ecosystem we'll nee to add support for this in
prefresh
, which comes down to adding the new property in hereFor consumers who leverage both signals and hooks this is a slight downgrade, however, the added bytes are minimal in signals so I would encourage catering to users who use one of both rather than both.
Thinking more about this, a lot of our ecosystem libraries like i.e. preact-iso do leverage signals so in that regards this would be just an addition in byte-size. Gotta think this through a bit more.