mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 08:50:18 +00:00
fix: reset current page to initial value on limit change in pagination (#18940)
* fix: reset current page to initial value on limit change in pagination * fix: reset current page for APICollectionVersion page --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
744eee12e4
commit
a0b1a4e925
@ -188,6 +188,7 @@ export const UserTab = ({
|
||||
|
||||
useEffect(() => {
|
||||
getCurrentTeamUsers(currentTeam.name);
|
||||
handlePageChange(INITIAL_PAGING_VALUE);
|
||||
}, [currentTeam, pageSize]);
|
||||
|
||||
const isTeamDeleted = useMemo(
|
||||
|
@ -103,7 +103,13 @@ const APICollectionPage: FunctionComponent = () => {
|
||||
const { getEntityPermissionByFqn } = usePermissionProvider();
|
||||
const pagingInfo = usePaging(PAGE_SIZE);
|
||||
|
||||
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||
const {
|
||||
paging,
|
||||
pageSize,
|
||||
handlePagingChange,
|
||||
handlePageChange,
|
||||
currentPage,
|
||||
} = pagingInfo;
|
||||
|
||||
const { tab: activeTab = EntityTabs.API_ENDPOINT } =
|
||||
useParams<{ tab: EntityTabs }>();
|
||||
@ -130,8 +136,6 @@ const APICollectionPage: FunctionComponent = () => {
|
||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||
const [showDeletedEndpoints, setShowDeletedEndpoints] =
|
||||
useState<boolean>(false);
|
||||
const [currentEndpointsPage, setCurrentEndpointsPage] =
|
||||
useState<number>(INITIAL_PAGING_VALUE);
|
||||
|
||||
const extraDropdownContent = useMemo(
|
||||
() =>
|
||||
@ -145,7 +149,7 @@ const APICollectionPage: FunctionComponent = () => {
|
||||
|
||||
const handleShowDeletedEndPoints = (value: boolean) => {
|
||||
setShowDeletedEndpoints(value);
|
||||
setCurrentEndpointsPage(INITIAL_PAGING_VALUE);
|
||||
handlePageChange(INITIAL_PAGING_VALUE);
|
||||
};
|
||||
|
||||
const { currentVersion, tags, tier, apiCollectionId } = useMemo(
|
||||
@ -459,7 +463,7 @@ const APICollectionPage: FunctionComponent = () => {
|
||||
},
|
||||
});
|
||||
}
|
||||
setCurrentEndpointsPage(currentPage);
|
||||
handlePageChange(currentPage);
|
||||
},
|
||||
[paging, getAPICollectionEndpoints]
|
||||
);
|
||||
@ -584,7 +588,7 @@ const APICollectionPage: FunctionComponent = () => {
|
||||
apiCollectionDetails={apiCollection}
|
||||
apiEndpoints={apiEndpoints}
|
||||
apiEndpointsLoading={apiEndpointsLoading}
|
||||
currentEndpointsPage={currentEndpointsPage}
|
||||
currentEndpointsPage={currentPage}
|
||||
description={apiCollection?.description ?? ''}
|
||||
editDescriptionPermission={editDescriptionPermission}
|
||||
endpointPaginationHandler={endpointPaginationHandler}
|
||||
|
@ -32,7 +32,6 @@ import { DisplayType } from '../../components/Tag/TagsViewer/TagsViewer.interfac
|
||||
import {
|
||||
getEntityDetailsPath,
|
||||
getVersionPath,
|
||||
INITIAL_PAGING_VALUE,
|
||||
PAGE_SIZE,
|
||||
} from '../../constants/constants';
|
||||
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
||||
@ -86,7 +85,13 @@ const APICollectionVersionPage = () => {
|
||||
|
||||
const pagingInfo = usePaging(PAGE_SIZE);
|
||||
|
||||
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||
const {
|
||||
paging,
|
||||
pageSize,
|
||||
handlePagingChange,
|
||||
handlePageChange,
|
||||
currentPage,
|
||||
} = pagingInfo;
|
||||
|
||||
const [collectionPermissions, setCollectionPermissions] =
|
||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||
@ -106,9 +111,6 @@ const APICollectionVersionPage = () => {
|
||||
|
||||
const [apiEndpoints, setAPIEndpoints] = useState<Array<APIEndpoint>>([]);
|
||||
|
||||
const [currentEndpointsPage, setCurrentEndpointsPage] =
|
||||
useState<number>(INITIAL_PAGING_VALUE);
|
||||
|
||||
const { tier, owners, breadcrumbLinks, changeDescription, deleted, domain } =
|
||||
useMemo(
|
||||
() =>
|
||||
@ -235,7 +237,7 @@ const APICollectionVersionPage = () => {
|
||||
},
|
||||
});
|
||||
}
|
||||
setCurrentEndpointsPage(currentPage);
|
||||
handlePageChange(currentPage);
|
||||
},
|
||||
[paging, getAPICollectionEndpoints]
|
||||
);
|
||||
@ -286,7 +288,7 @@ const APICollectionVersionPage = () => {
|
||||
apiCollectionDetails={currentVersionData}
|
||||
apiEndpoints={apiEndpoints}
|
||||
apiEndpointsLoading={apiEndpointsLoading}
|
||||
currentEndpointsPage={currentEndpointsPage}
|
||||
currentEndpointsPage={currentPage}
|
||||
description={description}
|
||||
endpointPaginationHandler={endpointPaginationHandler}
|
||||
pagingInfo={pagingInfo}
|
||||
@ -348,7 +350,7 @@ const APICollectionVersionPage = () => {
|
||||
currentVersionData,
|
||||
apiEndpoints,
|
||||
apiEndpointsLoading,
|
||||
currentEndpointsPage,
|
||||
currentPage,
|
||||
endpointPaginationHandler,
|
||||
viewVersionPermission,
|
||||
]
|
||||
|
@ -94,7 +94,13 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
const { getEntityPermissionByFqn } = usePermissionProvider();
|
||||
const pagingInfo = usePaging(PAGE_SIZE);
|
||||
|
||||
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||
const {
|
||||
paging,
|
||||
pageSize,
|
||||
handlePagingChange,
|
||||
currentPage,
|
||||
handlePageChange,
|
||||
} = pagingInfo;
|
||||
|
||||
const { tab: activeTab = EntityTabs.TABLE } =
|
||||
useParams<{ tab: EntityTabs }>();
|
||||
@ -121,8 +127,6 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
const [databaseSchemaPermission, setDatabaseSchemaPermission] =
|
||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||
const [showDeletedTables, setShowDeletedTables] = useState<boolean>(false);
|
||||
const [currentTablesPage, setCurrentTablesPage] =
|
||||
useState<number>(INITIAL_PAGING_VALUE);
|
||||
const [storedProcedureCount, setStoredProcedureCount] = useState(0);
|
||||
|
||||
const [updateProfilerSetting, setUpdateProfilerSetting] =
|
||||
@ -140,7 +144,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
|
||||
const handleShowDeletedTables = (value: boolean) => {
|
||||
setShowDeletedTables(value);
|
||||
setCurrentTablesPage(INITIAL_PAGING_VALUE);
|
||||
handlePageChange(INITIAL_PAGING_VALUE);
|
||||
};
|
||||
|
||||
const { version: currentVersion, deleted } = useMemo(
|
||||
@ -458,7 +462,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
if (cursorType) {
|
||||
getSchemaTables({ [cursorType]: paging[cursorType] });
|
||||
}
|
||||
setCurrentTablesPage(currentPage);
|
||||
handlePageChange(currentPage);
|
||||
},
|
||||
[paging, getSchemaTables]
|
||||
);
|
||||
@ -579,7 +583,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
feedCount,
|
||||
tableData,
|
||||
activeTab,
|
||||
currentTablesPage,
|
||||
currentTablesPage: currentPage,
|
||||
databaseSchema,
|
||||
description,
|
||||
editDescriptionPermission,
|
||||
@ -611,7 +615,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
|
||||
feedCount,
|
||||
tableData,
|
||||
activeTab,
|
||||
currentTablesPage,
|
||||
currentPage,
|
||||
databaseSchema,
|
||||
description,
|
||||
editDescriptionPermission,
|
||||
|
@ -31,7 +31,6 @@ import { DisplayType } from '../../components/Tag/TagsViewer/TagsViewer.interfac
|
||||
import {
|
||||
getEntityDetailsPath,
|
||||
getVersionPath,
|
||||
INITIAL_PAGING_VALUE,
|
||||
PAGE_SIZE,
|
||||
} from '../../constants/constants';
|
||||
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
||||
@ -76,9 +75,14 @@ function DatabaseSchemaVersionPage() {
|
||||
|
||||
const pagingInfo = usePaging(PAGE_SIZE);
|
||||
|
||||
const { paging, pageSize, handlePagingChange } = pagingInfo;
|
||||
const {
|
||||
paging,
|
||||
pageSize,
|
||||
handlePagingChange,
|
||||
handlePageChange,
|
||||
currentPage,
|
||||
} = pagingInfo;
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(INITIAL_PAGING_VALUE);
|
||||
const [tableData, setTableData] = useState<Array<Table>>([]);
|
||||
const [servicePermissions, setServicePermissions] =
|
||||
useState<OperationPermission>(DEFAULT_ENTITY_PERMISSION);
|
||||
@ -195,7 +199,7 @@ function DatabaseSchemaVersionPage() {
|
||||
if (cursorType) {
|
||||
getSchemaTables({ [cursorType]: paging[cursorType] });
|
||||
}
|
||||
setCurrentPage(currentPage);
|
||||
handlePageChange(currentPage);
|
||||
},
|
||||
[paging, getSchemaTables]
|
||||
);
|
||||
|
@ -780,8 +780,8 @@ const ServiceDetailsPage: FunctionComponent = () => {
|
||||
getOtherDetails({
|
||||
[cursorType]: paging[cursorType],
|
||||
});
|
||||
handlePageChange(currentPage);
|
||||
}
|
||||
handlePageChange(currentPage);
|
||||
},
|
||||
[paging, getOtherDetails, handlePageChange]
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user