Closed madeleineostoja closed 2 years ago
What purpose would triggering an update (render) be useful for if that property is not used in the render function?
It's relatively trivial to use autorun or other mobx observable methods to drive a computation that is stored on a property of the component that then drives the render update naturally like other property updated callbacks.
Other than being an opinionated and undocumented footgun (it took me SO long to debug why my lit-mobx integration wasn't working), I don't think it's beyond imagination to use pure logic/state based observables whose output aren't directly rendered but instead change what is rendered through local state/props. Like layout settings, global state, etc.
In those cases you should just be using mobx directly. There's no need to automatically wrap every property into an observable context since 99% of them wouldn't be mobx observable.
Sure but it should still be documented if nothing else
Added a note to the README.
Expected Behaviour
Observables should trigger
updated()
when extendingMobxLitElement
Actual Behaviour
Observables only trigger an update if used within the
render
callbackPlatform and Version
@adobe/lit-mobx
: 2.0.0mobx
: 6.6.1lit
: 2.2.8Sample Code that illustrates the problem
This is not reactive to observable/store updates
This is reactive