feat(ui): add global query cache leveraging Redis (#5811)
This commit is contained in:
1 parent
29bd7101b1
commit
74443a49b2
68 files changed
+843
-191
No files matched your search
@@ -10,6 +10,7 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { metricToImperial } from "@homarr/common";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { WeatherDescription, WeatherIcon } from "./icon";
|
||||
|
||||
@@ -18,8 +19,8 @@ export default function WeatherWidget({ isEditMode, options }: WidgetComponentPr
|
||||
latitude: options.location.latitude,
|
||||
longitude: options.location.longitude,
|
||||
};
|
||||
const [weather] = clientApi.widget.weather.atLocation.useSuspenseQuery(input, {
|
||||
refetchOnMount: false,
|
||||
const { data: weather } = clientApi.widget.weather.atLocation.useQuery(input, {
|
||||
staleTime: 60 * 1000,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
});
|
||||
@@ -29,6 +30,8 @@ export default function WeatherWidget({ isEditMode, options }: WidgetComponentPr
|
||||
onData: (data) => utils.widget.weather.atLocation.setData(input, data),
|
||||
});
|
||||
|
||||
if (!weather) return <WidgetEmptyState />;
|
||||
|
||||
return (
|
||||
<Stack
|
||||
align="center"
|
||||
|
||||
Reference in new issue
Block a user