Releases: preactjs/signals
Release list
@preact/signals-debug@1.4.2
Patch Changes
- #887
a559c3aThanks @rschristian! - Ensure we specify the proper peerDependencies in the package.json
@preact/signals@2.8.1
Patch Changes
- #883
849413fThanks @JoviDeCroock! - Ensure that re-mounting components preserve the DOM updaters correctly
@preact/signals-devtools-ui@0.4.1
Patch Changes
- #872
8848febThanks @JoviDeCroock! - Dark mode in devtools
@preact/signals-debug@1.4.1
Patch Changes
- #867
2587dd0Thanks @JoviDeCroock! - Avoid callingconsole.groupon effects, they can't have descendants
@preact/signals@2.8.0
Minor Changes
- #878
4aa565bThanks @JoviDeCroock! - Support returning a plain array in thewhenof aForcomponent
@preact/signals-react@3.9.0
Minor Changes
- #878
4aa565bThanks @JoviDeCroock! - Support returning a plain array in thewhenof aForcomponent
@preact/signals@2.7.1
Patch Changes
- #870
c8636faThanks @JoviDeCroock! - Prevent scheduled effects from highjacking the execution-context
@preact/signals@1.3.4
Patch Changes
- #869
27157f5Thanks @JoviDeCroock! - Prevent scheduled effects from highjacking the execution-context
@preact/signals@2.7.0
Minor Changes
-
#861
5794b04Thanks @andrewiggins! - AdduseModelhook for using Models in componentsThe new
useModelhook provides a convenient way to use Models (created withcreateModel) within React and Preact components. It handles:- Creating the model instance lazily on first render
- Maintaining the same instance across re-renders
- Automatically disposing the model when the component unmounts
import { createModel, signal } from "@preact/signals-core"; import { useModel } from "@preact/signals-react"; // or "@preact/signals" const CountModel = createModel(() => ({ count: signal(0), increment() { this.count.value++; }, })); function Counter() { const model = useModel(CountModel); return <button onClick={() => model.increment()}>{model.count}</button>; }
For models that require constructor arguments, wrap in a factory function:
const CountModel = createModel((initialCount: number) => ({ count: signal(initialCount), })); function Counter() { const model = useModel(() => new CountModel(5)); return <div>{model.count}</div>; }
Patch Changes
-
#865
4872968Thanks @JoviDeCroock! - Revert #728 - this might entail work in prefresh but currently the presence ofuesStatemakes every sCU bail -
Updated dependencies [
19ac39b]:- @preact/signals-core@1.13.0
@preact/signals-react@3.8.0
Minor Changes
-
#861
5794b04Thanks @andrewiggins! - AdduseModelhook for using Models in componentsThe new
useModelhook provides a convenient way to use Models (created withcreateModel) within React and Preact components. It handles:- Creating the model instance lazily on first render
- Maintaining the same instance across re-renders
- Automatically disposing the model when the component unmounts
import { createModel, signal } from "@preact/signals-core"; import { useModel } from "@preact/signals-react"; // or "@preact/signals" const CountModel = createModel(() => ({ count: signal(0), increment() { this.count.value++; }, })); function Counter() { const model = useModel(CountModel); return <button onClick={() => model.increment()}>{model.count}</button>; }
For models that require constructor arguments, wrap in a factory function:
const CountModel = createModel((initialCount: number) => ({ count: signal(initialCount), })); function Counter() { const model = useModel(() => new CountModel(5)); return <div>{model.count}</div>; }
Patch Changes
- Updated dependencies [
19ac39b]:- @preact/signals-core@1.13.0