We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deepObserve observes everything deeply even if property is decorated by @observable.ref or @observable.shallow.
deepObserve
@observable.ref
@observable.shallow
import {observable, makeObserable} from 'mobx' import {deepObserve} from 'mobx-utils' class Entity { @observable.ref byRef?: Entity @observable property = 0 constructor() { makeObserable(this) } } const entity = new Entity() const dispose = deepObserve(entity, () => console.log('Change')) entity.byRef = new Entity() // Outputs "Change" to console (expected) entity.byRef.property++ // Outputs "Change" to console (unexpected) dispose()
import {observable} from 'mobx' import {deepObserve} from 'mobx-utils' class Entity { @observable.shallow shallow: Entity[] = [] @observable property = 0 constructor() { makeObserable(this) } } const entity = new Entity() const dispose = deepObserve(entity, () => console.log('Change')) entity.shallow.push(new Entity()) // Outputs "Change" to console (expected) entity.shallow[0].property++ // Outputs "Change" to console (unexpected) dispose()
MobX version: 6.3.5 MobX-utils version: 6.0.4
The text was updated successfully, but these errors were encountered:
Added possibility to respect observable decorator variants, sets can …
d40444e
…only be observed shallowly mobxjs#298, mobxjs#312
Successfully merging a pull request may close this issue.
deepObserve
observes everything deeply even if property is decorated by@observable.ref
or@observable.shallow
.MobX version: 6.3.5
MobX-utils version: 6.0.4
The text was updated successfully, but these errors were encountered: