Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: preactjs/signals
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @preact/signals@2.0.1
Choose a base ref
...
head repository: preactjs/signals
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @preact/signals@2.0.2
Choose a head ref
  • 4 commits
  • 7 files changed
  • 3 contributors

Commits on Jan 13, 2025

  1. Upgrade pnpm (#645)

    * Upgrade pnpm
    
    * Update .github/workflows/release.yml
    JoviDeCroock authored Jan 13, 2025
    Copy the full SHA
    ad95a9b View commit details

Commits on Feb 15, 2025

  1. Use vnode._dom (#655)

    JoviDeCroock authored Feb 15, 2025
    Copy the full SHA
    6a0284c View commit details

Commits on Mar 26, 2025

  1. Use afterNextFrame for hidden origins (#660)

    * Use afterNextFrame for hidden origins
    
    * Update packages/preact/src/index.ts
    
    * Update packages/preact/src/index.ts
    
    Co-authored-by: Jason Miller <developit@users.noreply.github.com>
    
    * Rename `afterNextFrame` to `safeRaf`, fix missing semicolons
    
    ---------
    
    Co-authored-by: Jason Miller <developit@users.noreply.github.com>
    JoviDeCroock and developit authored Mar 26, 2025
    Copy the full SHA
    df4df76 View commit details
  2. Version Packages (#656)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Mar 26, 2025
    Copy the full SHA
    352b345 View commit details
Showing with 5,305 additions and 4,329 deletions.
  1. +1 −1 .github/workflows/compressed-size.yml
  2. +1 −1 .github/workflows/main.yml
  3. +1 −1 .github/workflows/release.yml
  4. +8 −0 packages/preact/CHANGELOG.md
  5. +1 −1 packages/preact/package.json
  6. +14 −5 packages/preact/src/index.ts
  7. +5,279 −4,320 pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .github/workflows/compressed-size.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.12

- name: compressed-size-action
uses: preactjs/compressed-size-action@v2
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.12

- name: Install Node.js
uses: actions/setup-node@v4
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.12

- name: Install Node.js
uses: actions/setup-node@v4
8 changes: 8 additions & 0 deletions packages/preact/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @preact/signals

## 2.0.2

### Patch Changes

- [#655](https://github.com/preactjs/signals/pull/655) [`6a0284c`](https://github.com/preactjs/signals/commit/6a0284ca233e666e16fcab2584269e2344062519) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Avoid usage of `.base` and check the `_dom` on the vnode instead

- [#660](https://github.com/preactjs/signals/pull/660) [`df4df76`](https://github.com/preactjs/signals/commit/df4df765bdeef3e976969d865f8d386a5effebd8) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Bail out of the animation frame with a setTimeout in case the origin page is hidden

## 2.0.1

### Patch Changes
2 changes: 1 addition & 1 deletion packages/preact/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@preact/signals",
"version": "2.0.1",
"version": "2.0.2",
"license": "MIT",
"description": "Manage state with style in Preact",
"keywords": [],
19 changes: 14 additions & 5 deletions packages/preact/src/index.ts
Original file line number Diff line number Diff line change
@@ -119,8 +119,8 @@ function SignalValue(this: AugmentedComponent, { data }: { data: Signal }) {
// undefined before mounting or a non-text node. In both of those cases
// the update gets handled by a full rerender.
const value = wrappedSignal.value;
if (self.base && self.base.nodeType === 3) {
(self.base as Text).data = value;
if (self.__v && self.__v.__e && self.__v.__e.nodeType === 3) {
(self.__v.__e as Text).data = value;
}
}
});
@@ -388,10 +388,19 @@ export function useComputed<T>(compute: () => T) {
return useMemo(() => computed<T>(() => $compute.current()), []);
}

function safeRaf(callback: () => void) {
const done = () => {
clearTimeout(timeout);
cancelAnimationFrame(raf);
callback();
};

const timeout = setTimeout(done, 100);
const raf = requestAnimationFrame(done);
}

const deferEffects =
typeof requestAnimationFrame === "undefined"
? setTimeout
: requestAnimationFrame;
typeof requestAnimationFrame === "undefined" ? setTimeout : safeRaf;

const deferDomUpdates = (cb: any) => {
queueMicrotask(() => {
Loading