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

Implement hooks without using hooks #199

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Implement hooks without using hooks #199

wants to merge 6 commits into from

Conversation

developit
Copy link
Member

This PR reimplements useSignal(), useComputed() and useEffect() without using preact/hooks. This should offer some performance advantages, because the three hooks we provide can all be implemented using the same very simple "indexed slot" mechanism, effectively an inline implementation of the useMemo hook.

There are some possible drawbacks here though: I don't know if this will mess up DevTools, and it's possible it would make Prefresh's job more difficult (though I also wonder if it gives Prefresh a useful way to differentiate between Signals and Hooks?).

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2022

⚠️ No Changeset found

Latest commit: 1207a26

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Sep 22, 2022

Deploy Preview for preact-signals-demo ready!

Name Link
🔨 Latest commit 1207a26
🔍 Latest deploy log https://app.netlify.com/sites/preact-signals-demo/deploys/634588876ce9a10009bc2ddf
😎 Deploy Preview https://deploy-preview-199--preact-signals-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 22, 2022

Size Change: +106 B (0%)

Total Size: 67.2 kB

Filename Size Change
docs/dist/assets/index.********.js 835 B -1 B (0%)
docs/dist/assets/signals.module.********.js 1.14 kB -831 B (-42%) 🎉
docs/dist/assets/style.********.css 1.19 kB -21 B (-2%)
docs/dist/basic-********.js 244 B -2 B (-1%)
docs/dist/demos-********.js 4.22 kB +868 B (+26%) 🚨
packages/preact/dist/signals.js 1.25 kB +51 B (+4%)
packages/preact/dist/signals.mjs 1.19 kB +42 B (+4%)
ℹ️ View Unchanged
Filename Size
docs/dist/assets/client.********.js 45.7 kB
docs/dist/assets/jsxRuntime.module.********.js 282 B
docs/dist/assets/preact.module.********.js 4 kB
docs/dist/assets/signals-core.module.********.js 1.33 kB
docs/dist/assets/style.********.js 21 B
docs/dist/nesting-********.js 1.13 kB
docs/dist/react-********.js 239 B
packages/core/dist/signals-core.js 1.39 kB
packages/core/dist/signals-core.mjs 1.42 kB
packages/react/dist/signals.js 790 B
packages/react/dist/signals.mjs 764 B

compressed-size-action

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

Successfully merging this pull request may close these issues.

1 participant