Closed andrewiggins closed 7 months ago
Latest commit: fe0ff1d4dd9c67196eda0542b853ed727c6ac334
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Name | Link |
---|---|
Latest commit | fe0ff1d4dd9c67196eda0542b853ed727c6ac334 |
Latest deploy log | https://app.netlify.com/sites/preact-signals-demo/deploys/6568583d4c870000086b74d0 |
Deploy Preview | https://deploy-preview-458--preact-signals-demo.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Size Change: +202 B (0%)
Total Size: 84.1 kB
Filename | Size | Change |
---|---|---|
packages/react-transform/dist/signals-*********.js |
4.83 kB | +67 B (+1%) |
packages/react-transform/dist/signals-transform.mjs |
4.08 kB | +68 B (+2%) |
packages/react-transform/dist/signals-transform.umd.js |
4.95 kB | +67 B (+1%) |
It's possible to use the
@trackSignals
comment manually opt-in to the react signals transform on a function that isn't obviously a Component or hook. Before, we would always wrap those functions in atry/finally
clause. However, this could break signal tracking if the function was actually used as a hook.For example:
We fix the bug described in the comment above by just prepending
useSignals()
. This method of tracking signals in React relies on a microtick to close the effect meaning any signals accessed in "... other stuff ..." will be captured by this effect.More improvements to this scenario will come in a follow up PR.
This PR also adds more tests for transforming hooks in general.