fix: change fetchAndUpdateNetworks to be a cached callback

This commit is contained in:
Derrick Hammer 2023-10-12 11:46:53 -04:00
parent ccce11d34d
commit f68070e38c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ const LumeProvider = ({ children }) => {
});
}, []);
const fetchAndUpdateNetworks = async () => {
const fetchAndUpdateNetworks = useCallback(async () => {
const unsub = () => {
statusUnsubs.current.forEach((unsub) => unsub());
statusUnsubs.current = new Map<any, any>();
@ -118,7 +118,7 @@ const LumeProvider = ({ children }) => {
console.error("Error fetching and updating networks:", error);
}
}
};
}, [handleStatusUpdate]);
useEffect(() => {
fetchAndUpdateNetworks();