Fixed pagination bug due to fixed entry (#19075)

This commit is contained in:
Erik Jan de Wit 2023-03-21 10:55:30 +01:00 committed by GitHub
parent 46eb2e1b84
commit 0ddb0f9022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,22 +176,18 @@ export const ClientScopes = ({
const filter =
searchType === "name" ? nameFilter(search) : typeFilter(searchTypeType);
const firstNum = Number(first);
const page = localeSort(rows.filter(filter), mapByKey("name")).slice(
firstNum,
firstNum + Number(max)
);
if (firstNum === 0 && isManager) {
return [
{
id: DEDICATED_ROW,
name: t("dedicatedScopeName", { clientName }),
type: AllClientScopes.none,
description: t("dedicatedScopeDescription"),
},
...page,
];
const page = localeSort(rows.filter(filter), mapByKey("name"));
if (isManager) {
page.unshift({
id: DEDICATED_ROW,
name: t("dedicatedScopeName", { clientName }),
type: AllClientScopes.none,
description: t("dedicatedScopeDescription"),
});
}
return page;
return page.slice(firstNum, firstNum + Number(max));
};
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({