[gui] Only call fetchStatistics if the filters are ready - #5052
[gui] Only call fetchStatistics if the filters are ready#5052gulyasgergely902 wants to merge 1 commit into
Conversation
dkrupp
left a comment
There was a problem hiding this comment.
I am not so fan of timers, because it can introduce flaky behaviour depending on (browser/machine).
Also the debounce mechanism hides multiple sequential events and selects teh first one randomly. Are the filters already loaded then?
I think a much clearer solution would be to define a 1 callback which is fired once all filter is loaded and the data need to be refetched.
- filter change
- page reload
- tab change
e06e7e1 to
082bb38
Compare
dkrupp
left a comment
There was a problem hiding this comment.
please check my minor comments. otherwise looks good.
|
|
||
| function refresh() { | ||
| function refresh(reason) { | ||
| ccService.getClient().getRunResultCount( |
There was a problem hiding this comment.
please consider protecting these calls with early return for the case when the filters are not ready yet.
|
|
||
| function refreshCurrentTab() { | ||
| function emitRefresh() { | ||
| bus.emit("refresh"); |
There was a problem hiding this comment.
consider clarifying the naming of the refresh to distinguish between "filter refresh" and "statistics refresh" events. This will make the code more understandable.
efe2abe to
055ee8f
Compare
This change introduces reasons for report filters to why the emit was invoked. Based on this, it can be filtered when a refresh was actually needed and when not.
055ee8f to
1288a75
Compare
This change fixes an issue where fetchStatistics were called multiple times even before the reports filters were ready. This made the UI unresponsive at times.