web/elements: keep selected elements in table when fetching (#7519)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-11-14 11:49:11 +01:00 committed by GitHub
parent 627b3bc095
commit 31592712a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 7 deletions

View File

@ -194,7 +194,6 @@ export abstract class Table<T> extends AKElement {
this.data = await this.apiEndpoint(this.page);
this.error = undefined;
this.page = this.data.pagination.current;
const newSelected: T[] = [];
const newExpanded: T[] = [];
this.data.results.forEach((res) => {
const jsonRes = JSON.stringify(res);
@ -214,18 +213,12 @@ export abstract class Table<T> extends AKElement {
);
};
}
const selectedIndex = this.selectedElements.findIndex(comp);
if (selectedIndex > -1) {
newSelected.push(res);
}
const expandedIndex = this.expandedElements.findIndex(comp);
if (expandedIndex > -1) {
newExpanded.push(res);
}
});
this.isLoading = false;
this.selectedElements = newSelected;
this.expandedElements = newExpanded;
} catch (ex) {
this.isLoading = false;