From 720fb542d9f693d6d47d954c19b64b8a058e3c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 21 May 2026 09:55:57 +0200 Subject: [PATCH] cleanup(catalog-react): remove dead appliedCursor field, fix cursor-mode guard, inline getPaginationMode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Fredrik Adelöw --- .../src/hooks/useEntityListProvider.tsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index ced298b17d..01a02da7a3 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -145,7 +145,6 @@ type BackendState = { backendEntities: Entity[]; pageInfo?: QueryEntitiesResponse['pageInfo']; totalItems?: number; - appliedCursor?: string; }; /** @@ -174,16 +173,12 @@ export const EntityListProvider = ( // update of the URL or two catalog sidebar links with different catalog filters. const location = useLocation(); - const getPaginationMode = (): PaginationMode => { - if (props.pagination === true) { - return 'cursor'; - } - return typeof props.pagination === 'object' - ? props.pagination.mode ?? 'cursor' - : 'none'; - }; - - const paginationMode = getPaginationMode(); + let paginationMode: PaginationMode = 'none'; + if (props.pagination === true) { + paginationMode = 'cursor'; + } else if (typeof props.pagination === 'object') { + paginationMode = props.pagination.mode ?? 'cursor'; + } const paginationLimit = typeof props.pagination === 'object' ? props.pagination.limit ?? 20 : 20; @@ -273,7 +268,6 @@ export const EntityListProvider = ( backendEntities: response.items, pageInfo: response.pageInfo, totalItems: response.totalItems, - appliedCursor: cursor, }; }; } else { @@ -307,7 +301,13 @@ export const EntityListProvider = ( // No filters registered yet — wait for filter components to // call updateFilters before making the first request. - if (compacted.length === 0 && lastFetchParamsRef.current === undefined) { + // Exception: a cursor in the URL is a self-contained page reference + // that doesn't need filter state to be valid. + if ( + compacted.length === 0 && + lastFetchParamsRef.current === undefined && + !cursor + ) { setLoading(false); return; }