fix(App): update ctx api actions hook logic

This commit is contained in:
Tim 2022-12-29 09:38:11 +01:00
parent 43f3481632
commit 2beaffc9ab

View file

@ -91,7 +91,6 @@ const App = () => {
}, []);
React.useEffect(() => {
const onWindowFocus = () => {
if (services.core.active) {
services.core.transport.dispatch({
action: 'Ctx',
args: {
@ -110,9 +109,11 @@ const App = () => {
action: 'SyncLibraryWithAPI'
}
});
}
};
if (services.core.active) {
onWindowFocus();
window.addEventListener('focus', onWindowFocus);
}
return () => window.removeEventListener('focus', onWindowFocus);
}, [initialized]);
return (