mirror of https://github.com/jetkvm/kvm.git
The getPermissions useEffect had send and pollPermissions in its dependency array. Since send gets recreated when rpcDataChannel changes, this caused multiple getPermissions RPC calls (5 observed) on page load. Fix: - Add rpcDataChannel readiness check to prevent calls before channel is open - Remove send and pollPermissions from dependency array - Keep only currentMode and rpcDataChannel.readyState as dependencies This ensures getPermissions is called only when: 1. The RPC channel becomes ready (readyState changes to "open") 2. The session mode changes (observer <-> primary) Eliminates duplicate RPC calls while maintaining correct behavior for mode changes and initial connection. |
||
|---|---|---|
| .. | ||
| hidRpc.ts | ||
| stores.ts | ||
| useAppNavigation.ts | ||
| useFeatureFlag.ts | ||
| useHidRpc.ts | ||
| useJsonRpc.ts | ||
| useKeyboard.ts | ||
| useKeyboardLayout.ts | ||
| useMouse.ts | ||
| usePermissions.ts | ||
| useSessionEvents.ts | ||
| useSessionManagement.ts | ||
| useVersion.tsx | ||