Reputation: 550
Sources here on develop
branch.
In this simple app, I use autorunAsync
to debounce searchText
updates and fetch Giphy API accordingly. Everything works fine until I want to display a simple loader next to the input while a request is processing.
Uncommenting this line ends up with the action being fired infinitely.
I thought that autorun
and autorunAsync
would fire the action only when the targeted observable is modified. (searchText
in my case)
How to combine both side effects (like API fetching) and state update within the same action ? I tried transaction
, but I couldn't make it work either..
I need more time to wrap my head around MobX concept and I'm sure this is a stupid mistake. :)
Any help appreciated
Upvotes: 1
Views: 719
Reputation: 4978
Your setup is correct. This was actually a bug in autorunAsync
. MobX 2.0.2 should fix this issue.
Upvotes: 1