mirror of https://github.com/jetkvm/kvm.git
fix: prevent infinite getLocalVersion RPC calls on refresh
The getLocalVersion useEffect had getLocalVersion and hasPermission in its dependency array. Since these functions are recreated on every render, this caused an infinite loop of RPC calls when refreshing the primary session, resulting in 100+ identical getLocalVersion requests. Fix: Remove function references from dependency array, only keep appVersion which is the actual data dependency. The effect now only runs once when appVersion changes from null to a value. This is the same pattern as the previous fix for getVideoState, getKeyboardLedState, and getKeyDownState.
This commit is contained in:
parent
f90c255656
commit
00e6edbfa8
|
|
@ -898,7 +898,8 @@ export default function KvmIdRoute() {
|
|||
if (!hasPermission(Permission.VIDEO_VIEW)) return;
|
||||
|
||||
getLocalVersion();
|
||||
}, [appVersion, getLocalVersion, hasPermission]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [appVersion]);
|
||||
|
||||
const ConnectionStatusElement = useMemo(() => {
|
||||
const hasConnectionFailed =
|
||||
|
|
|
|||
Loading…
Reference in New Issue