Skip to content
New issue

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

Disposer of async reactions should also cancel pending sideeffect/action #1148

Closed
ptomask opened this issue Aug 23, 2017 · 2 comments
Closed
Labels

Comments

@ptomask
Copy link

ptomask commented Aug 23, 2017

When disposer of autorunAsync or reaction is called after there was a change in their tracked inputs, action/sideEffect is still triggered:

//... a is observable...
this.a = 1;
const dispose = reaction(() => this.a, () => console.log('Reaction run.'), {delay: 1});
this.a = 2;
dispose();
// ... Now 'Reaction run.' will still be printed out.

For me the expected behavior would be that calling the disposer also cancels internal timeout.

@mweststrate
Copy link
Member

Agreed, PR is welcome :)

@mweststrate
Copy link
Member

Fixed in MobX4

mweststrate added a commit that referenced this issue Feb 27, 2018
@mweststrate mweststrate mentioned this issue Feb 27, 2018
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants