1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-11-29 22:48:28 +02:00

Fix contentwrapper packing and unpacking issue

This commit is contained in:
Patrik J. Braun
2025-11-10 22:28:45 +01:00
parent 20faa89297
commit e42cf4ce21
3 changed files with 12 additions and 11 deletions

View File

@@ -220,7 +220,7 @@ export class GalleryMWs {
}
}
ContentWrapperUtils.pack(cw);
req.resultPipe = ContentWrapperUtils.pack(cw);
return next();
}

View File

@@ -64,7 +64,13 @@ export class ContentWrapperUtils {
}
const c1 = cw1.directory || cw1.searchResult;
const c2 = cw2.directory || cw2.searchResult;
if (c1 === c2) {
return true;
}
if (!c1 || !c2) {
return false;
}
if (!this.equalsDirectories(c1.directories, c2.directories)) {
return false;
}
@@ -181,7 +187,6 @@ export class ContentWrapperUtils {
static pack(cwIn: ContentWrapper): PackedContentWrapper {
const cw: PackedContentWrapper = {
...cwIn,
map: {
faces: [], keywords: [], lens: [],
camera: [], directories: []
@@ -189,7 +194,8 @@ export class ContentWrapperUtils {
reverseMap: {
faces: new Map(), keywords: new Map(),
lens: new Map(), camera: new Map(), directories: new Map()
}
},
...cwIn
};
if (cw?.directory) {

View File

@@ -57,8 +57,7 @@ export class ContentLoaderService {
// load from cache
const cw = this.galleryCacheService.getDirectory(directoryName);
ContentWrapperUtils.unpack(cw);
this.setContent(cw);
this.setContent( ContentWrapperUtils.unpack(cw));
this.lastRequest.directory = directoryName;
this.currentContentRequest = {type: 'directory', value: directoryName};
@@ -99,10 +98,7 @@ export class ContentLoaderService {
if (this.lastRequest.directory !== directoryName) {
return;
}
ContentWrapperUtils.unpack(cw);
this.setContent(cw);
this.setContent(ContentWrapperUtils.unpack(cw));
} catch (e) {
console.error(e);
this.navigationService.toGallery().catch(console.error);
@@ -140,8 +136,7 @@ export class ContentLoaderService {
return;
}
ContentWrapperUtils.unpack(cw);
this.setContent(cw);
this.setContent(ContentWrapperUtils.unpack(cw));
}
isSearchResult(): boolean {