Skip to content

Commit

Permalink
Handle assoc list error
Browse files Browse the repository at this point in the history
On this way, the ui does not block and it shows and error message
  • Loading branch information
selankon committed Mar 25, 2024
1 parent 97a3930 commit 76528ed
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions plugins/lime-plugin-align/src/containers/alignSingle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -90,6 +91,18 @@ const AlignSingle = ({ iface, mac }) => {
);
}

if (isError || !assocList) {
return (
<div className="container container-center">
<Trans>Error retrieving associated list</Trans>
</div>
);
}

const station = assocList && getStation(assocList, mac);
const fromRadio = ifaceToRadioNumber(iface);
const toRadio = bathost.iface && ifaceToRadioNumber(bathost.iface);

return (
<div className="d-flex flex-grow-1 flex-column container-padded">
<div className="d-flex">
Expand Down

0 comments on commit 76528ed

Please sign in to comment.