Computed behavior changed between 0.8.1 and 0.9.0
peschee opened this issue · comments
Peter Siska commented
Given this example:
const one = atom<string | undefined>(undefined);
const two = computed(one, (value: string | undefined) => !!value);
and this code:
console.log('one', one.get());
console.log('two', two.get());
in 0.8.1
, the output / values were
undefined
false
in 0.9.0
, the output / values are
undefined
undefined
Is this expected?
Example projects are here:
Andrey Sitnik commented
@TrySound could it be related with your changes?
Bogdan Chadkin commented
Yes, notify always forced recomputing before. Now check fails when undefined is compared to out of range index. Need to add array length check additionally.
Good catch @peschee, thanks
Fixing
Bogdan Chadkin commented
Andrey Sitnik commented
The fix was released in 0.9.1
Peter Siska commented
Awesome, thanks for a quick fix!