fix: reset page on filter change and remove client-side filtering (#20043)
* fix: reset page on filter change * remove unused filterFn
This commit is contained in:
1 parent
ef2c34c55f
commit
6c01f5eace
9 files changed
+22
-136
No files matched your search
@@ -155,10 +155,6 @@ function UserListTableContent({ oAuthClientId }: PlatformManagedUsersTableProps)
|
||||
</div>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, id, filterValue) => {
|
||||
const userEmail = rows.original.email;
|
||||
return filterValue.includes(userEmail);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "role",
|
||||
@@ -181,15 +177,6 @@ function UserListTableContent({ oAuthClientId }: PlatformManagedUsersTableProps)
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, id, filterValue) => {
|
||||
if (filterValue.includes("PENDING")) {
|
||||
if (filterValue.length === 1) return !rows.original.accepted;
|
||||
else return !rows.original.accepted || filterValue.includes(rows.getValue(id));
|
||||
}
|
||||
|
||||
// Show only the selected roles
|
||||
return filterValue.includes(rows.getValue(id));
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "teams",
|
||||
@@ -230,10 +217,6 @@ function UserListTableContent({ oAuthClientId }: PlatformManagedUsersTableProps)
|
||||
</div>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, _, filterValue: string[]) => {
|
||||
const teamNames = rows.original.teams.map((team) => team.name);
|
||||
return filterValue.some((value: string) => teamNames.includes(value));
|
||||
},
|
||||
},
|
||||
];
|
||||
return cols;
|
||||
|
||||
@@ -13,12 +13,6 @@ import {
|
||||
DataTableSelectionBar,
|
||||
DataTableFilters,
|
||||
useColumnFilters,
|
||||
textFilter,
|
||||
isTextFilterValue,
|
||||
isSingleSelectFilterValue,
|
||||
isMultiSelectFilterValue,
|
||||
singleSelectFilter,
|
||||
multiSelectFilter,
|
||||
ColumnFilterType,
|
||||
convertFacetedValuesToMap,
|
||||
useDataTable,
|
||||
@@ -237,18 +231,6 @@ function UserListTableContent() {
|
||||
</div>
|
||||
);
|
||||
},
|
||||
filterFn: (row, id, filterValue) => {
|
||||
const attributeValues = row.original.attributes?.filter((attr) => attr.attributeId === id);
|
||||
|
||||
if (isTextFilterValue(filterValue)) {
|
||||
return attributeValues?.some((attr) => textFilter(attr.value, filterValue)) ?? false;
|
||||
} else if (isSingleSelectFilterValue(filterValue)) {
|
||||
return singleSelectFilter(attributeValues?.map((attr) => attr.value) ?? [], filterValue);
|
||||
} else if (isMultiSelectFilterValue(filterValue)) {
|
||||
return multiSelectFilter(attributeValues?.map((attr) => attr.value) ?? [], filterValue);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
}) ?? [];
|
||||
return attributeColumns;
|
||||
@@ -312,10 +294,6 @@ function UserListTableContent() {
|
||||
</div>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, id, filterValue) => {
|
||||
const userEmail = rows.original.email;
|
||||
return filterValue.includes(userEmail);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "role",
|
||||
@@ -335,15 +313,6 @@ function UserListTableContent() {
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, id, filterValue) => {
|
||||
if (filterValue.includes("PENDING")) {
|
||||
if (filterValue.length === 1) return !rows.original.accepted;
|
||||
else return !rows.original.accepted || filterValue.includes(rows.getValue(id));
|
||||
}
|
||||
|
||||
// Show only the selected roles
|
||||
return filterValue.includes(rows.getValue(id));
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "teams",
|
||||
@@ -381,10 +350,6 @@ function UserListTableContent() {
|
||||
</div>
|
||||
);
|
||||
},
|
||||
filterFn: (rows, _, filterValue: string[]) => {
|
||||
const teamNames = rows.original.teams.map((team) => team.name);
|
||||
return filterValue.some((value: string) => teamNames.includes(value));
|
||||
},
|
||||
},
|
||||
...generateAttributeColumns(),
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user