Closed nin-jin closed 1 year ago
Nice find, thank you!
But why this don't work?
let res = []
const { Reactive, stabilize } = $mol_import.module(
'https://esm.sh/@reactively/core'
)
const A = new Reactive(0)
const H = new Reactive( () => res.push( A.get() ), true )
H.get()
A.set(1)
stabilize()
$mol_assert_like( res, [ 0, 1 ] )
That's likely because the @reactively/core npm package hasn't been updated/published in a while, so the version distributed via npm doesn't have this fix. I noticed the bad effect behaviour while experimenting with this lib. Using the latest version from main
(with this fix) works well though.
Check for effect scheduling before state update