Skip to content

Commit

Permalink
web: fetch total when focus
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-rio committed Dec 4, 2024
1 parent d92444a commit bfebfad
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 10 deletions.
12 changes: 11 additions & 1 deletion web_viewer/fe_src/src/components/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@ function Summary({ invertData }: IProps) {
}
}, []);

const onVisibilityChange = useCallback(() => {
if (!document.hidden) {
fetchTotal();
}
}, [fetchTotal]);

useEffect(() => {
fetchTotal();
}, [fetchTotal]);
document.addEventListener("visibilitychange", onVisibilityChange);
return () => {
document.removeEventListener("visibilitychange", onVisibilityChange);
};
}, [fetchTotal, onVisibilityChange]);

return (
<div className="summary row">
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{j as e}from"./index-CV0EdXLl.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};
import{j as e}from"./index-D_IGb7wu.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion web_viewer/public/assets/Summary-B9ngYoyI.js

This file was deleted.

1 change: 1 addition & 0 deletions web_viewer/public/assets/Summary-k-qPP0fD.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bfebfad

Please sign in to comment.