You've already forked pigallery2
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:
@@ -220,7 +220,7 @@ export class GalleryMWs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentWrapperUtils.pack(cw);
|
req.resultPipe = ContentWrapperUtils.pack(cw);
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,13 @@ export class ContentWrapperUtils {
|
|||||||
}
|
}
|
||||||
const c1 = cw1.directory || cw1.searchResult;
|
const c1 = cw1.directory || cw1.searchResult;
|
||||||
const c2 = cw2.directory || cw2.searchResult;
|
const c2 = cw2.directory || cw2.searchResult;
|
||||||
|
if (c1 === c2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c1 || !c2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!this.equalsDirectories(c1.directories, c2.directories)) {
|
if (!this.equalsDirectories(c1.directories, c2.directories)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -181,7 +187,6 @@ export class ContentWrapperUtils {
|
|||||||
|
|
||||||
static pack(cwIn: ContentWrapper): PackedContentWrapper {
|
static pack(cwIn: ContentWrapper): PackedContentWrapper {
|
||||||
const cw: PackedContentWrapper = {
|
const cw: PackedContentWrapper = {
|
||||||
...cwIn,
|
|
||||||
map: {
|
map: {
|
||||||
faces: [], keywords: [], lens: [],
|
faces: [], keywords: [], lens: [],
|
||||||
camera: [], directories: []
|
camera: [], directories: []
|
||||||
@@ -189,7 +194,8 @@ export class ContentWrapperUtils {
|
|||||||
reverseMap: {
|
reverseMap: {
|
||||||
faces: new Map(), keywords: new Map(),
|
faces: new Map(), keywords: new Map(),
|
||||||
lens: new Map(), camera: new Map(), directories: new Map()
|
lens: new Map(), camera: new Map(), directories: new Map()
|
||||||
}
|
},
|
||||||
|
...cwIn
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cw?.directory) {
|
if (cw?.directory) {
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ export class ContentLoaderService {
|
|||||||
// load from cache
|
// load from cache
|
||||||
const cw = this.galleryCacheService.getDirectory(directoryName);
|
const cw = this.galleryCacheService.getDirectory(directoryName);
|
||||||
|
|
||||||
ContentWrapperUtils.unpack(cw);
|
this.setContent( ContentWrapperUtils.unpack(cw));
|
||||||
this.setContent(cw);
|
|
||||||
this.lastRequest.directory = directoryName;
|
this.lastRequest.directory = directoryName;
|
||||||
this.currentContentRequest = {type: 'directory', value: directoryName};
|
this.currentContentRequest = {type: 'directory', value: directoryName};
|
||||||
|
|
||||||
@@ -99,10 +98,7 @@ export class ContentLoaderService {
|
|||||||
if (this.lastRequest.directory !== directoryName) {
|
if (this.lastRequest.directory !== directoryName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.setContent(ContentWrapperUtils.unpack(cw));
|
||||||
ContentWrapperUtils.unpack(cw);
|
|
||||||
|
|
||||||
this.setContent(cw);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
this.navigationService.toGallery().catch(console.error);
|
this.navigationService.toGallery().catch(console.error);
|
||||||
@@ -140,8 +136,7 @@ export class ContentLoaderService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentWrapperUtils.unpack(cw);
|
this.setContent(ContentWrapperUtils.unpack(cw));
|
||||||
this.setContent(cw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isSearchResult(): boolean {
|
isSearchResult(): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user