preactjs / signals

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

refactor: inline cycle errors & use a shared .peek() implementation for signals and computeds #526

Closed jviide closed 3 months ago

jviide commented 3 months ago

This pull request

A couple of new tests are included to test that computeds' peek() still throws errors when the computed function fails.

In aggregate these changes save between 10 and 29 bytes, depending on the output format:

Before:
       1481 B: signals-core.js.gz
       1350 B: signals-core.js.br
       1494 B: signals-core.mjs.gz
       1363 B: signals-core.mjs.br
       1488 B: signals-core.module.js.gz
       1352 B: signals-core.module.js.br
       1557 B: signals-core.min.js.gz
       1414 B: signals-core.min.js.br

After:
       1454 B: signals-core.js.gz
       1324 B: signals-core.js.br
       1474 B: signals-core.mjs.gz
       1356 B: signals-core.mjs.br
       1468 B: signals-core.module.js.gz
       1337 B: signals-core.module.js.br
       1528 B: signals-core.min.js.gz
       1401 B: signals-core.min.js.br
changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: 18fa480b6c596edf7a2a750efc0f77084a64e6dc

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](https://github.com/jviide/signals/new/inline-cycle-errors?filename=.changeset/sour-pears-rescue.md&value=---%0A%22%40preact%2Fsignals-core%22%3A%20patch%0A---%0A%0Arefactor%3A%20inline%20cycle%20errors%20%26%20use%20a%20shared%20.peek()%20implementation%20for%20signals%20and%20computeds%0A)

netlify[bot] commented 3 months ago

Deploy Preview for preact-signals-demo ready!

Name Link
Latest commit 18fa480b6c596edf7a2a750efc0f77084a64e6dc
Latest deploy log https://app.netlify.com/sites/preact-signals-demo/deploys/65f245ee1bc1930008865160
Deploy Preview https://deploy-preview-526--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 configuration.