diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a075a1..f0b9d65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning]. +## [1.4.6] - 2024-05-17 +### Fixed +- `useTablePagination` hook + ## [1.4.5] - 2024-05-09 ### Fixed - `ProposalDepositsRow` deposit tx parsing @@ -124,7 +128,8 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic - Initiated project -[Unreleased]: https://gitlab.com/rarimo/scan/compare/1.4.5...HEAD +[Unreleased]: https://gitlab.com/rarimo/scan/compare/1.4.6...HEAD +[1.4.6]: https://gitlab.com/rarimo/scan/compare/1.4.5...1.4.6 [1.4.5]: https://gitlab.com/rarimo/scan/compare/1.4.4...1.4.5 [1.4.4]: https://gitlab.com/rarimo/scan/compare/1.4.3...1.4.4 [1.4.3]: https://gitlab.com/rarimo/scan/compare/1.4.2...1.4.3 diff --git a/package.json b/package.json index 432058e..dd38d73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scan", - "version": "1.4.5", + "version": "1.4.6", "private": true, "gitHooks": { "pre-commit": "yarn lint", diff --git a/src/components/TableWithPagination.tsx b/src/components/TableWithPagination.tsx index 1a49f44..8422595 100644 --- a/src/components/TableWithPagination.tsx +++ b/src/components/TableWithPagination.tsx @@ -1,5 +1,7 @@ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown' import { + Skeleton, + Stack, Table, TableBody, TableContainer, @@ -53,7 +55,29 @@ export default function TableWithPagination({ }) { const theme = useTheme() - const table = ( + if (isLoading) { + return ( + + {Array.from({ length: limit }).map((_, idx) => { + return + })} + + ) + } + + if (!rows?.length || isLoadingError) { + return ( + + ) + } + + return ( <> ) - - return !isLoading && (!rows?.length || isLoadingError) ? ( - - ) : ( - table - ) } diff --git a/src/components/Validator/Validator.tsx b/src/components/Validator/Validator.tsx index 1a9c868..21675a4 100644 --- a/src/components/Validator/Validator.tsx +++ b/src/components/Validator/Validator.tsx @@ -25,7 +25,7 @@ import { ValidatorDelegationsFilters, ValidatorDelegationsFiltersMapStringKey } export default function Validator({ operator }: { operator: string }) { const { limit, offset, handleChangePage, handleChangeRowsPerPage, setOffset, setTableKey } = - useTablePagination() + useTablePagination('validator_delegations') const { filter, handleFilterChange } = useTabsFilter({ queryKey: 'delegation_type', @@ -82,7 +82,8 @@ export default function Validator({ operator }: { operator: string }) { useEffect(() => { setKey() - }, [filter, setKey, setTableKey]) + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [filter]) useEffect(() => { setKey() diff --git a/src/hooks/useTablePagination.ts b/src/hooks/useTablePagination.ts index 20aefc3..adfa554 100644 --- a/src/hooks/useTablePagination.ts +++ b/src/hooks/useTablePagination.ts @@ -101,7 +101,9 @@ export const useTablePagination = (tableKey?: string) => { useEffect(() => { replaceUrl() - }, [limit, offset, order, orderBy, replaceUrl, table]) + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [limit, offset, order, orderBy, table]) useEffect(() => { replaceUrl()