fix(frontend): guard the outbounds WebSocket handler against non-array payloads

onOutbounds wrote the raw WebSocket payload straight into the
outboundsTraffic cache, unlike the sibling onNodes/onInbounds handlers which
first check Array.isArray. A malformed non-array push (for example an object)
would land in the cache with staleTime Infinity; consumers that call
.find()/.map() on the outbounds list would then throw and crash the Outbounds
tab. Add the same Array.isArray guard so a bad push is ignored.
This commit is contained in:
MHSanaei
2026-07-15 05:17:31 +02:00
parent 58b88800b4
commit d2ba6c9fc2
2 changed files with 52 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@ export function useWebSocketBridge() {
};
const onOutbounds: Handler = (payload) => {
if (!Array.isArray(payload)) return;
queryClient.setQueryData(keys.xray.outboundsTraffic(), payload);
};