Releases: tomasklaen/statin
3.1.0
Features
computed(fn)
now receives previous value as its 1st argument (725a9d7) @tomasklaen- Added
signal.get/set
methods, aliased assignal.r/w
(77c5171) @tomasklaen
Full Changelog: 3.0.0...3.1.0
3.0.0
The only change in this version is that you can no longer write into a signal inside a computed signal.
Computed signals should only derive state, not create or modify it. Doing so produces a lot of weird edge cases, undefined behaviors, and errors. Making this explicitly forbidden seems to be the best way forward.
For example, this will now throw an error:
const s = signal(1);
const c = computed(() => {
const value = s() * 10;
s(2);
return value;
});
Before, this would ignore the change signal sent by s(2)
, causing computed to have a stale state.
2.0.0
This release makes all signals automatically run in an action context, which bulks their effects. This means it is no longer necessary to wrap single signal changes inside an action to prevent duplicate reactions caused by computed properties depended on them:
// Before
action(() => s('foo'));
// After
s('foo'); // automatically bulks effects
This shouldn't make any difference to existing code, but since it does remove setStrict()
, which is now unnecessary, it's a major bump.
Breaking
- Removed
setStrict()
.