Improve performance by comparing file ids instead of hashes

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent 24a8b1ce39
commit 2691653274

@ -173,7 +173,7 @@ export class FileGalleryComponent implements OnChanges, OnInit {
private getPreselectedEntry(): Selectable<File> | undefined {
if (this.preselectedFile) {
const entry = this.entries.find(
e => e.data.hash == this.preselectedFile?.hash);
e => e.data.id === this.preselectedFile?.id);
if (entry) {
return entry;
}

@ -78,7 +78,7 @@ export class FilesTabSidebarComponent implements OnInit, OnChanges {
private async refreshFileSelection() {
const filteredSelection = this.selectedFiles.filter(
file => this.files.findIndex(f => f.hash === file.hash) >= 0);
file => this.files.findIndex(f => f.id === file.id) >= 0);
if (filteredSelection.length === 0) {
this.tags = [];
this.showAllTagsFallback();
@ -93,7 +93,6 @@ export class FilesTabSidebarComponent implements OnInit, OnChanges {
this.tags = this.tagsOfFiles.sort(
(a, b) => a.getNormalizedOutput()
.localeCompare(b.getNormalizedOutput()));
;
}
}
}

Loading…
Cancel
Save