Skip to content

Releases: preactjs/signals

@preact/signals-react-transform@0.8.1

Choose a tag to compare

@github-actions github-actions released this 04 Feb 08:11
28b5900

Patch Changes

  • #814 a5d0a6e Thanks @andrewiggins! - Fix JSX detection leaking to non-component functions in the same scope

    Previously, when a component containing JSX was defined inside another function, the JSX detection could incorrectly "leak" to sibling functions or the parent function, causing non-components to be transformed. This was especially problematic in test files where components are defined inside it() or describe() blocks.

    describe("suite", () => {
    	it("test", () => {
    		// This arrow function was incorrectly transformed because
    		// Counter's JSX detection leaked to sibling functions
    		const CountModel = () => signal.value;
    		function Counter() {
    			return <div>Hello</div>;
    		}
    	});
    });

    The transform now correctly scopes JSX and signal usage detection to only the containing component or custom hook function.

  • Updated dependencies [5794b04]:

    • @preact/signals-react@3.8.0

@preact/signals-devtools-ui@0.4.0

Choose a tag to compare

@github-actions github-actions released this 04 Feb 08:11
28b5900

Minor Changes

Patch Changes

  • Updated dependencies [00ba858]:
    • @preact/signals-devtools-adapter@0.4.0

@preact/signals-devtools-adapter@0.4.0

Choose a tag to compare

@github-actions github-actions released this 04 Feb 08:11
28b5900

Minor Changes

@preact/signals-debug@1.4.0

Choose a tag to compare

@github-actions github-actions released this 04 Feb 08:11
28b5900

Minor Changes

@preact/signals-core@1.13.0

Choose a tag to compare

@github-actions github-actions released this 04 Feb 08:11
28b5900

Minor Changes

  • #812 19ac39b Thanks @andrewiggins! - Add createModel and action to signals core package

    createModel provides a structured way to create reactive model classes that encapsulate signals, computed values, and actions:

    const CounterModel = createModel((initialCount = 0) => {
    	const count = signal(initialCount);
    	const doubled = computed(() => count.value * 2);
    
    	effect(() => {
    		console.log("Count changed:", count.value);
    	});
    
    	return {
    		count,
    		doubled,
    		increment() {
    			count.value++;
    		},
    	};
    });
    
    const counter = new CounterModel(5);
    counter.increment(); // Updates are automatically batched
    counter[Symbol.dispose](); // Cleans up all effects

    Key features:

    • Factory functions can accept arguments for initialization
    • All methods are automatically wrapped as actions (batched & untracked)
    • Effects created during model construction are captured and disposed when the model is disposed via Symbol.dispose
    • TypeScript validates that models only contain signals, actions, or nested objects with signals/actions

    action is a helper that wraps a function to run batched and untracked:

    const updateAll = action(items => {
    	items.forEach(item => item.value++);
    }); // All updates batched into single notification

@preact/signals@2.6.2

Choose a tag to compare

@github-actions github-actions released this 30 Jan 16:49
e98c4a5

Patch Changes

@preact/signals@1.3.3

Choose a tag to compare

@github-actions github-actions released this 29 Jan 17:12
7b84120

Patch Changes

@preact/signals-devtools-ui@0.3.0

Choose a tag to compare

@github-actions github-actions released this 26 Jan 11:42
7c892cf

Minor Changes

Patch Changes

@preact/signals-devtools-ui@0.2.0

Choose a tag to compare

@github-actions github-actions released this 22 Jan 15:55
bd8bcd4

Minor Changes

Patch Changes

  • Updated dependencies [030e428]:
    • @preact/signals-devtools-adapter@0.2.0

@preact/signals-debug@1.2.1

Choose a tag to compare

@github-actions github-actions released this 22 Jan 19:55
b561a7c

Patch Changes