My biggest concern with it is the example where I show Vue imitating Svelte. I don't think things that should be derived should be modelled that way, but when people do that inevitably out of laziness it's awkward because part of it has updated and other parts haven't. With React or Svelte you at least know that nothing downstream has run.
Yeah that seems like a bug if it never picks up again. I think I know when I broke that. Thanks for the heads up.
Out of curiousity though what do you expect to happen around the first error case. In Vue or Solid or any reactive library count() is set by that point and doubleCount couldn't be calculated. Should it throw on read?
For this reason, no separate effects are used when using $mol_wire. Instead, the same invariants are used that describe the usual reactive dependencies as well, but neither can change something on the side besides the return value. This gives a stable, predictable and manageable moment of applying side effects.
@memcount(next=1){returnnext}@memdoubleCount(){returnthis.count()*2}@memcountLog(){console.log('count',this.count())}@memdoubleCountLog(){console.log('doubleCount',this.doubleCount())}@memrender(){console.log('[')this.doubleCountLog()this.countLog()console.log(']')}@actmain(){// initialthis.render()// logs: [ 2 1 ]// change statethis.count(2)// no logsthis.count(3)// no logs// don't wait next framethis.render()// logs: 6 3// check memoizingthis.render()// no logs}
$mol_wire and MobX have similar exception behavior - they are transparent to them as [if there were no intermediate memoization and the computation starts from scratch every time they are accessed] - this gives a simpler mental model.
My biggest concern with it is the example where I show Vue imitating Svelte. I don't think things that should be derived should be modelled that way, but when people do that inevitably out of laziness it's awkward because part of it has updated and other parts haven't. With React or Svelte you at least know that nothing downstream has run.
Yeah that seems like a bug if it never picks up again. I think I know when I broke that. Thanks for the heads up.
Out of curiousity though what do you expect to happen around the first error case. In Vue or Solid or any reactive library
count()
is set by that point anddoubleCount
couldn't be calculated. Should it throw on read?For this reason, no separate effects are used when using $mol_wire. Instead, the same invariants are used that describe the usual reactive dependencies as well, but neither can change something on the side besides the return value. This gives a stable, predictable and manageable moment of applying side effects.
Sandbox
$mol_wire and MobX have similar exception behavior - they are transparent to them as [if there were no intermediate memoization and the computation starts from scratch every time they are accessed] - this gives a simpler mental model.
Sandbox
Thanks this is good information. I appreciate you taking the time to explain.