From d9d0ac96f93ba580013ed6d93a7cd10c21b1492d Mon Sep 17 00:00:00 2001 From: gamenew09 Date: Fri, 18 Oct 2024 08:34:33 -0500 Subject: [PATCH] fix: WiFi connection status not being replicated when connected network is removed via `removeNetwork`. (#4) --- web/src/stores/connection.store.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/src/stores/connection.store.ts b/web/src/stores/connection.store.ts index bba278a..f06b3e8 100644 --- a/web/src/stores/connection.store.ts +++ b/web/src/stores/connection.store.ts @@ -64,7 +64,15 @@ useNuiEvent('addNetwork', (data: WifiNetwork) => { useNuiEvent('removeNetwork', (ssid: string) => { const connection = useConnection() + const oldConnections = connection.networks connection.networks = connection.networks.filter((network) => network.ssid !== ssid) + + // Check to see if the networks array was changed via the filter operation. + // If it was, let the network event bus be aware of this change. + if(oldConnections.length !== connection.networks.length) { + const networkBus = useEventBus('network') + networkBus.emit('updated') + } }) useNuiEvent('connect', (ssid: string) => {