Răsfoiți Sursa

reset select all checkbox when refetching

Yuki Takei 4 ani în urmă
părinte
comite
92c7f3a624
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      packages/app/src/components/SearchPage2.tsx

+ 9 - 1
packages/app/src/components/SearchPage2.tsx

@@ -1,5 +1,5 @@
 import React, {
 import React, {
-  useCallback, useMemo, useState,
+  useCallback, useEffect, useMemo, useState,
 } from 'react';
 } from 'react';
 import { useTranslation } from 'react-i18next';
 import { useTranslation } from 'react-i18next';
 
 
@@ -123,6 +123,7 @@ export const SearchPage = (props: Props): JSX.Element => {
     };
     };
   }, []);
   }, []);
 
 
+
   const hitsCount = data?.meta.hitsCount;
   const hitsCount = data?.meta.hitsCount;
   const { offset, limit } = conditions;
   const { offset, limit } = conditions;
 
 
@@ -193,6 +194,13 @@ export const SearchPage = (props: Props): JSX.Element => {
     );
     );
   }, [conditions, configurationsByPagination?.limit, data, pagingNumberChangedHandler]);
   }, [conditions, configurationsByPagination?.limit, data, pagingNumberChangedHandler]);
 
 
+  // reset selected count when data is refetched
+  useEffect(() => {
+    if (data != null) {
+      setSelectedPagesCount(0);
+    }
+  }, [data, setSelectedPagesCount]);
+
   return (
   return (
     <SearchPageBase
     <SearchPageBase
       appContainer={appContainer}
       appContainer={appContainer}