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:
Alex P 2025-10-10 22:15:44 +03:00
parent f90c255656
commit 00e6edbfa8
1 changed files with 2 additions and 1 deletions

View File

@ -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 =