feat: simplify caching — TanStack Query as single source of truth (#6075)
This commit is contained in:
1 parent
a5ec880eec
commit
f19033e0d5
187 files changed
+1013
-4712
No files matched your search
@@ -19,16 +19,7 @@ export default function WeatherWidget({ isEditMode, options }: WidgetComponentPr
|
||||
latitude: options.location.latitude,
|
||||
longitude: options.location.longitude,
|
||||
};
|
||||
const { data: weather } = clientApi.widget.weather.atLocation.useQuery(input, {
|
||||
staleTime: 60 * 1000,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
});
|
||||
|
||||
const utils = clientApi.useUtils();
|
||||
clientApi.widget.weather.subscribeAtLocation.useSubscription(input, {
|
||||
onData: (data) => utils.widget.weather.atLocation.setData(input, data),
|
||||
});
|
||||
const { data: weather } = clientApi.widget.weather.atLocation.useQuery(input);
|
||||
|
||||
if (!weather) return <WidgetEmptyState />;
|
||||
|
||||
|
||||
Reference in new issue
Block a user