I have a simple user component that loads a specific user entry in it:
Essentally all it does it first loads a list of users, creates buttons for all them and displays one if selected. Once that happens, the users data is loaded and displayed. The control also refreshes itself automatically every 2 seconds.
Only the problem is that if in between the refresh timer being fired and the request from the api being the returned, a new user is selected, the refresh action will display the previous user instead of the new one, before correcting itself and loading the correct user in the subsequent load.
This happens because while the timer is cleared after a new user is selected, the previous timers request may still be running.
I think in order for this to work I need to detect at line 48 that the user has changed since the refresh was started and not setUserData
The problem is I have no way of finding out the actual current value of the user property.
Is there a way to do this or am I just going about it the wrong way?