Skip to content

Commit

Permalink
HPCC-30052 Stop frequent calls to WsSMC/Activity.json
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Aug 8, 2023
1 parent 7fe7615 commit bebacdd
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions esp/src/src-react/hooks/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ export function useActivity(): [Activity, number, () => void] {
React.useEffect(() => {
const activity = Activity.attach({ baseUrl: "" });
let active = true;
let handle;
activity.lazyRefresh().then(() => {
if (active) {
setActivity(activity);
handle = activity.watch(() => {
setLastUpdate(Date.now());
});
setLastUpdate(Date.now());
}
});
return () => {
active = false;
handle.release();
};
}, [count]);

Expand Down

0 comments on commit bebacdd

Please sign in to comment.