mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 06:38:46 +00:00
place error boundaries closer to the source
This commit is contained in:
parent
88c774339d
commit
ea96999377
6 changed files with 31 additions and 21 deletions
|
@ -1,5 +1,7 @@
|
|||
import dynamic from "next/dynamic";
|
||||
|
||||
import ErrorBoundary from "components/errorboundry";
|
||||
|
||||
const widgetMappings = {
|
||||
weatherapi: dynamic(() => import("components/widgets/weather/weather")),
|
||||
openweathermap: dynamic(() => import("components/widgets/openweathermap/weather")),
|
||||
|
@ -13,7 +15,11 @@ export default function Widget({ widget }) {
|
|||
const InfoWidget = widgetMappings[widget.type];
|
||||
|
||||
if (InfoWidget) {
|
||||
return <InfoWidget options={widget.options} />;
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<InfoWidget options={widget.options} />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue