diff --git a/src/frontend/app/ui/gallery/cache.gallery.service.ts b/src/frontend/app/ui/gallery/cache.gallery.service.ts index 2b335d73..20818b31 100644 --- a/src/frontend/app/ui/gallery/cache.gallery.service.ts +++ b/src/frontend/app/ui/gallery/cache.gallery.service.ts @@ -183,6 +183,9 @@ export class GalleryCacheService { if (Config.Gallery.enableCache === false) { return null; } + if (typeof query === 'string') { + throw new Error('query expected to by object. Got:' + query); + } const key = GalleryCacheService.SEARCH_PREFIX + JSON.stringify(query); return GalleryCacheService.loadCacheItem(key); } diff --git a/src/frontend/app/ui/gallery/content.service.ts b/src/frontend/app/ui/gallery/content.service.ts index 9adb9378..bd9ca59a 100644 --- a/src/frontend/app/ui/gallery/content.service.ts +++ b/src/frontend/app/ui/gallery/content.service.ts @@ -26,7 +26,7 @@ export class ContentService { }; private lastDirectory: ParentDirectoryDTO; private searchId: any; - private ongoingSearch: SearchQueryDTO = null; + private ongoingSearch: string = null; constructor( private networkService: NetworkService, @@ -102,7 +102,7 @@ export class ContentService { } } - public async search(query: SearchQueryDTO): Promise { + public async search(query: string): Promise { if (this.searchId != null) { clearTimeout(this.searchId); } @@ -110,7 +110,7 @@ export class ContentService { this.ongoingSearch = query; this.setContent(new ContentWrapperWithError()); - let cw = this.galleryCacheService.getSearch(query); + let cw = this.galleryCacheService.getSearch(JSON.parse(query)); if (!cw || cw.searchResult == null) { try { cw = await this.networkService.getJson('/search/' + query);