chore(react/ribbon): bring back tab filtering

This commit is contained in:
Elian Doran
2025-08-22 15:53:52 +03:00
parent bf0213907e
commit b99d01ad7b
5 changed files with 45 additions and 68 deletions

View File

@@ -788,6 +788,22 @@ export function arrayEqual<T>(a: T[], b: T[]) {
return true;
}
type Indexed<T extends object> = T & { index: number };
/**
* Given an object array, alters every object in the array to have an index field assigned to it.
*
* @param items the objects to be numbered.
* @returns the same object for convenience, with the type changed to indicate the new index field.
*/
export function numberObjectsInPlace<T extends object>(items: T[]): Indexed<T>[] {
let index = 0;
for (const item of items) {
(item as Indexed<T>).index = index++;
}
return items as Indexed<T>[];
}
export default {
reloadFrontendApp,
restartDesktopApp,