From 76528edb420eed6523605599b5941b26fdbf7a80 Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 25 Mar 2024 13:33:48 +0100 Subject: [PATCH] Handle assoc list error On this way, the ui does not block and it shows and error message --- .../src/containers/alignSingle/index.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/plugins/lime-plugin-align/src/containers/alignSingle/index.js b/plugins/lime-plugin-align/src/containers/alignSingle/index.js index 26b97ce5..7fb3bd4b 100644 --- a/plugins/lime-plugin-align/src/containers/alignSingle/index.js +++ b/plugins/lime-plugin-align/src/containers/alignSingle/index.js @@ -75,12 +75,13 @@ const SignalBox = ({ signal }) => ( const AlignSingle = ({ iface, mac }) => { const { data: bathost } = useBatHost(mac, iface); - const { data: assocList, isLoading } = useAssocList(iface, { + const { + data: assocList, + isLoading, + isError, + } = useAssocList(iface, { refetchInterval: 2000, }); - const station = assocList && getStation(assocList, mac); - const fromRadio = ifaceToRadioNumber(iface); - const toRadio = bathost.iface && ifaceToRadioNumber(bathost.iface); if (isLoading) { return ( @@ -90,6 +91,18 @@ const AlignSingle = ({ iface, mac }) => { ); } + if (isError || !assocList) { + return ( +
+ Error retrieving associated list +
+ ); + } + + const station = assocList && getStation(assocList, mac); + const fromRadio = ifaceToRadioNumber(iface); + const toRadio = bathost.iface && ifaceToRadioNumber(bathost.iface); + return (