Always revalidate first page for local source browse requests
fixes #1041
This commit is contained in:
@@ -404,7 +404,7 @@ export function SourceMangas() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const requiresClear = SPECIAL_ED_SOURCES.REVALIDATION.includes(sourceId);
|
const requiresClear = SPECIAL_ED_SOURCES.REVALIDATION_UNSUPPORTED.includes(sourceId);
|
||||||
if (!requiresClear) {
|
if (!requiresClear) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ import { useLocalStorage } from '@/base/hooks/useStorage.tsx';
|
|||||||
import { KO_SYNC_LOGIN, KO_SYNC_LOGOUT } from '@/lib/graphql/mutations/KoreaderSyncMutation.ts';
|
import { KO_SYNC_LOGIN, KO_SYNC_LOGOUT } from '@/lib/graphql/mutations/KoreaderSyncMutation.ts';
|
||||||
import { GET_KO_SYNC_STATUS } from '@/lib/graphql/queries/KoreaderSyncQuery.ts';
|
import { GET_KO_SYNC_STATUS } from '@/lib/graphql/queries/KoreaderSyncQuery.ts';
|
||||||
import { ImageCache } from '@/lib/service-worker/ImageCache.ts';
|
import { ImageCache } from '@/lib/service-worker/ImageCache.ts';
|
||||||
|
import { Sources } from '@/features/source/services/Sources.ts';
|
||||||
|
|
||||||
enum GQLMethod {
|
enum GQLMethod {
|
||||||
QUERY = 'QUERY',
|
QUERY = 'QUERY',
|
||||||
@@ -453,9 +454,10 @@ const CACHE_PAGES_KEY = 'GET_SOURCE_MANGAS_FETCH_PAGES';
|
|||||||
const CACHE_RESULTS_KEY = 'GET_SOURCE_MANGAS_FETCH';
|
const CACHE_RESULTS_KEY = 'GET_SOURCE_MANGAS_FETCH';
|
||||||
|
|
||||||
export const SPECIAL_ED_SOURCES = {
|
export const SPECIAL_ED_SOURCES = {
|
||||||
REVALIDATION: [
|
REVALIDATION_UNSUPPORTED: [
|
||||||
'57122881048805941', // e-hentai
|
'57122881048805941', // e-hentai
|
||||||
],
|
],
|
||||||
|
REVALIDATION_SKIP_TTL: [Sources.LOCAL_SOURCE_ID],
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO - extract logic to reduce the size of this file... grew waaaaaaaaaaaaay too big peepoFat
|
// TODO - extract logic to reduce the size of this file... grew waaaaaaaaaaaaay too big peepoFat
|
||||||
@@ -594,7 +596,7 @@ export class RequestManager {
|
|||||||
maxPage: number,
|
maxPage: number,
|
||||||
signal: AbortSignal,
|
signal: AbortSignal,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (SPECIAL_ED_SOURCES.REVALIDATION.includes(sourceId)) {
|
if (SPECIAL_ED_SOURCES.REVALIDATION_UNSUPPORTED.includes(sourceId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +605,7 @@ export class RequestManager {
|
|||||||
Date.now() - (this.cache.getFetchTimestampFor(cacheResultsKey, getVariablesFor(pageToRevalidate)) ?? 0) >=
|
Date.now() - (this.cache.getFetchTimestampFor(cacheResultsKey, getVariablesFor(pageToRevalidate)) ?? 0) >=
|
||||||
d(5).minutes.inWholeMilliseconds;
|
d(5).minutes.inWholeMilliseconds;
|
||||||
|
|
||||||
if (isFirstPage && !isTtlReached) {
|
if (isFirstPage && !isTtlReached && !SPECIAL_ED_SOURCES.REVALIDATION_SKIP_TTL.includes(sourceId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user