frontend: optimized fetching behaviour
This commit is contained in:
parent
d48e138422
commit
38a9850142
|
@ -6,11 +6,13 @@ import HostOfferLookupTable from "./HostOfferLookupTable";
|
||||||
type HostLookupWrapperProps = Record<string, never>
|
type HostLookupWrapperProps = Record<string, never>
|
||||||
|
|
||||||
const HostOfferLookupWrapper = ({}: HostLookupWrapperProps) => {
|
const HostOfferLookupWrapper = ({}: HostLookupWrapperProps) => {
|
||||||
const {data, isFetching} = useGetOffersQuery({auth: testAuth as Auth}, {staleTime: 60 * 1000})
|
const staleTimeMinutes = 60 // hotfix till table settings by user (columns width, filters, sort options, …) are persisted
|
||||||
|
const {data, isFetching} = useGetOffersQuery({auth: testAuth as Auth}, {staleTime: staleTimeMinutes * 60 * 1000})
|
||||||
|
|
||||||
return <>{
|
return <>
|
||||||
(!isFetching && data?.get_offers) ? <HostOfferLookupTable data={data}/> : "loading…"
|
{ isFetching && <p> loading… </p> }
|
||||||
}</>
|
{ data?.get_offers && <HostOfferLookupTable data={data}/> }
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HostOfferLookupWrapper
|
export default HostOfferLookupWrapper
|
||||||
|
|
Loading…
Reference in New Issue