mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 20:33:47 +00:00
refactor: remove placeholderData pattern
This commit is contained in:
committed by
Carlos Valente
parent
71b2fa8e21
commit
93c913ec5a
@@ -27,18 +27,10 @@ export default function useRundown() {
|
||||
const { data, status, isError, refetch, isFetching } = useQuery<Rundown>({
|
||||
queryKey: RUNDOWN,
|
||||
queryFn: fetchCurrentRundown,
|
||||
placeholderData: (previousData, _previousQuery) => previousData,
|
||||
refetchInterval: queryRefetchIntervalSlow,
|
||||
});
|
||||
|
||||
const returnData = useMemo(() => {
|
||||
if (data && Array.isArray(data.flatOrder)) {
|
||||
return data;
|
||||
}
|
||||
return cachedRundownPlaceholder;
|
||||
}, [data]);
|
||||
|
||||
return { data: returnData, status, isError, refetch, isFetching };
|
||||
return { data: data ?? cachedRundownPlaceholder, status, isError, refetch, isFetching };
|
||||
}
|
||||
|
||||
export function useRundownWithMetadata() {
|
||||
|
||||
Reference in New Issue
Block a user