Replies: 2 comments
-
|
@mweststrate any thoughts on this now that you can see the code? It makes it so autoruns that are using array.length only respond to changes to length. function test({makeObservable, observable, action, autorun, toJS}:typeof mobx){
const do_test_action = (name, cb)=>{
console.log(`\n==Test: ${name}==`)
action(cb)()
console.log(`<==`)
}
let observed:any[];
observed = observable(['homer']) as Array<any>
autorun(() => {
console.log("array length observed: ", observed.length)
})
do_test_action('change homer', () => observed[0] += ' simpson')
}
test(mobx)
/* ~>
==Test: change homer==
array length observed: 1
<==
*/
test(mobx_modded)
/* ~>
==Test: change homer==
<==
*/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I suppose an issue might be that people are using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Adding an array.length Atom to make observation of
array.lengthas expected.1751937
This is the change I was recommending in #3988
Performance tests pass. The only tests that don't pass, apart from the tests that fail prior to my change, are those related to Spy changes.
If this is an acceptable change to mobx, I will update the Spy unit tests and send a pull request.
Beta Was this translation helpful? Give feedback.
All reactions