Closed rezoled closed 1 year ago
Inside *mobxAutorun
all changeable props must be marked as @observable
(show
in your case) and to change it, you have to call the method with @action
(so it's better to create method inside Component, and don't change it from template). Also when you have any @observable
's you have to call makeObservable(this);
inside constructor
Reproduction: https://stackblitz.com/edit/angular-pn2pgd
When you place an ngIf that changes the render result inside an mobxAutorun tag it breaks the mobxAutorun context and MobX assumes that everything inside the ngIf runs outside of an action/reaction
In the reproduction click the button and notice the errors in the console from MobX trace