From f05f60279fb504bfbfbf3b240e184df75ea1e35e Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Tue, 22 Oct 2024 09:21:51 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"Pr=C3=A9avis=20-=20Limite=20la=20fr?= =?UTF-8?q?=C3=A9quence=20des=20appels=20API=20apr=C3=A8s=20changement=20d?= =?UTF-8?q?e=20filtre=20dans=20la=20liste=20(#3780)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8fdc5c166b4536257480d261026a9a90086f3425, reversing changes made to ea0324bd9a1433b6e35984dbf47825e16cd7f4e7. --- .../PriorNotificationList/index.tsx | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/frontend/src/features/PriorNotification/components/PriorNotificationList/index.tsx b/frontend/src/features/PriorNotification/components/PriorNotificationList/index.tsx index 2b712ce363..ecfbfd5058 100644 --- a/frontend/src/features/PriorNotification/components/PriorNotificationList/index.tsx +++ b/frontend/src/features/PriorNotification/components/PriorNotificationList/index.tsx @@ -22,10 +22,9 @@ import { isLegacyFirefox } from '@utils/isLegacyFirefox' import { useIsSuperUser } from 'auth/hooks/useIsSuperUser' import { useCallback, useEffect, useRef, useState } from 'react' import styled, { css } from 'styled-components' -import { useDebounce } from 'use-debounce' import { getTableColumns } from './columns' -import { DEFAULT_PAGE_SIZE, ExpectedArrivalPeriod, SUB_MENUS_AS_OPTIONS } from './constants' +import { DEFAULT_PAGE_SIZE, SUB_MENUS_AS_OPTIONS } from './constants' import { FilterBar } from './FilterBar' import { FilterTags } from './FilterTags' import { Row } from './Row' @@ -69,26 +68,16 @@ export function PriorNotificationList({ isFromUrl }: PriorNotificationListProps) BackendApi.SortDirection.DESC ) - const [rtkQueryParams] = useDebounce( - { - apiPaginationParams, - apiSortingParams, - listFilter - }, - 1000 - ) - const areRtkQueryParamsValid = !( - rtkQueryParams.listFilter.expectedArrivalPeriod === ExpectedArrivalPeriod.CUSTOM && - !rtkQueryParams.listFilter.expectedArrivalCustomPeriod - ) + const rtkQueryParams = { + apiPaginationParams, + apiSortingParams, + listFilter + } // `!!error` !== `isError` because `isError` is `false` when the query is fetching. - const { data, error, isError, isFetching } = useGetPriorNotificationsQuery( - areRtkQueryParamsValid ? rtkQueryParams : skipToken, - { - ...RTK_ONE_MINUTE_POLLING_QUERY_OPTIONS, - ...RTK_FORCE_REFETCH_QUERY_OPTIONS - } - ) + const { data, error, isError, isFetching } = useGetPriorNotificationsQuery(rtkQueryParams, { + ...RTK_ONE_MINUTE_POLLING_QUERY_OPTIONS, + ...RTK_FORCE_REFETCH_QUERY_OPTIONS + }) useHandleFrontendApiError( DisplayedErrorKey.SIDE_WINDOW_PRIOR_NOTIFICATION_LIST_ERROR, error,