Fix: Improve error handling for Glances widgets when host is unreachable (#3657)

---------

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Matt Sullivan 2024-06-23 17:43:51 +01:00 committed by GitHub
parent ec448d6c41
commit f07d595ed9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 53 additions and 76 deletions

View file

@ -1,4 +1,21 @@
export default function Container({ children, chart = true, className = "" }) {
import { useContext } from "react";
import Error from "./error";
import { SettingsContext } from "utils/contexts/settings";
export default function Container({ children, widget, error = null, chart = true, className = "" }) {
const { settings } = useContext(SettingsContext);
const hideErrors = settings.hideErrors || widget?.hideErrors;
if (error) {
if (hideErrors) {
return null;
}
return <Error />;
}
return (
<div>
{children}