File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616
17- import { FC , useEffect , useState } from 'react' ;
17+ import { FC , useEffect , useRef , useState } from 'react' ;
1818import { resolveObjectAttribute } from '../utils/utils' ;
1919import useDataSource from './hooks/useDataSource' ;
2020import PaginationView from './pagination/PaginationView' ;
@@ -40,10 +40,13 @@ const RruDataTable: FC<RruDataTableProps> = ({
4040 const [ currentPage , setCurrentPage ] = useState ( defaultPageNumber || 0 ) ;
4141 const [ sortKey , setSortKey ] = useState ( defaultSortKey ) ;
4242 const [ sortDir , setSortDir ] = useState < SortDir > ( defaultSortDir ) ;
43- const [ searchParams , setSearchParams ] = useState < any > ( search ) ;
43+ const hasInit = useRef ( false ) ;
4444
4545 useEffect ( ( ) => {
46- setSearchParams ( search ) ;
46+ if ( ! hasInit . current ) {
47+ hasInit . current = true ;
48+ return ;
49+ }
4750 setCurrentPage ( 0 ) ;
4851 } , [ search ] ) ;
4952
@@ -53,7 +56,7 @@ const RruDataTable: FC<RruDataTableProps> = ({
5356 currentPage ,
5457 sortKey ,
5558 sortDir ,
56- searchParams ,
59+ search ,
5760 onChange
5861 ) ;
5962
You can’t perform that action at this time.
0 commit comments