Feature/global update last timestamp use stale data while fetching (#473)
* Cache last update timestamp * Correctly detect update as finished The update status on server side does not get reset, thus, in case a previous update was finished, it would get detected as finished and handled once on the initial render.
This commit is contained in:
@@ -118,8 +118,12 @@ export const Updates: React.FC = () => {
|
||||
const { data: downloaderData } = requestManager.useDownloadSubscription();
|
||||
const queue = (downloaderData?.downloadChanged.queue as DownloadType[]) ?? [];
|
||||
|
||||
const { data: lastUpdateTimestampData, refetch: refetchlastTimestamp } =
|
||||
requestManager.useGetLastGlobalUpdateTimestamp();
|
||||
const { data: lastUpdateTimestampData } = requestManager.useGetLastGlobalUpdateTimestamp({
|
||||
/**
|
||||
* The {@link UpdateChecker} is responsible for updating the timestamp
|
||||
*/
|
||||
fetchPolicy: 'cache-only',
|
||||
});
|
||||
const lastUpdateTimestamp = lastUpdateTimestampData?.lastUpdateTimestamp.timestamp;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -132,7 +136,7 @@ export const Updates: React.FC = () => {
|
||||
date: lastUpdateTimestamp ? new Date(+lastUpdateTimestamp).toLocaleString() : '-',
|
||||
})}
|
||||
</Typography>
|
||||
<UpdateChecker handleFinishedUpdate={() => refetchlastTimestamp()} />
|
||||
<UpdateChecker />
|
||||
</>,
|
||||
);
|
||||
}, [t, lastUpdateTimestamp]);
|
||||
|
||||
Reference in New Issue
Block a user