🐛 Fix torrent network traffic widget
This commit is contained in:
@@ -38,7 +38,7 @@ function TorrentNetworkTrafficTile({ widget }: TorrentNetworkTrafficTileProps) {
|
|||||||
const { t } = useTranslation(`modules/${definition.id}`);
|
const { t } = useTranslation(`modules/${definition.id}`);
|
||||||
const { colors } = useMantineTheme();
|
const { colors } = useMantineTheme();
|
||||||
const setSafeInterval = useSetSafeInterval();
|
const setSafeInterval = useSetSafeInterval();
|
||||||
const { config } = useConfigContext();
|
const { configVersion, config } = useConfigContext();
|
||||||
|
|
||||||
const [torrentHistory, torrentHistoryHandlers] = useListState<TorrentHistory>([]);
|
const [torrentHistory, torrentHistoryHandlers] = useListState<TorrentHistory>([]);
|
||||||
const [torrents, setTorrents] = useState<NormalizedTorrent[]>([]);
|
const [torrents, setTorrents] = useState<NormalizedTorrent[]>([]);
|
||||||
@@ -63,6 +63,7 @@ function TorrentNetworkTrafficTile({ widget }: TorrentNetworkTrafficTileProps) {
|
|||||||
setTorrents(response.data);
|
setTorrents(response.data);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
if (error.status === 401) return;
|
||||||
setTorrents([]);
|
setTorrents([]);
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error while fetching torrents', error.response.data);
|
console.error('Error while fetching torrents', error.response.data);
|
||||||
@@ -78,7 +79,7 @@ function TorrentNetworkTrafficTile({ widget }: TorrentNetworkTrafficTileProps) {
|
|||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}, [config?.apps]);
|
}, [configVersion]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
torrentHistoryHandlers.append({
|
torrentHistoryHandlers.append({
|
||||||
|
|||||||
Reference in New Issue
Block a user