mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 09:00:58 +03:00
fix(web): prevent search page error on missing album filter (#26948)
This commit is contained in:
@@ -67,7 +67,7 @@
|
|||||||
type SearchTerms = MetadataSearchDto & Pick<SmartSearchDto, 'query' | 'queryAssetId'>;
|
type SearchTerms = MetadataSearchDto & Pick<SmartSearchDto, 'query' | 'queryAssetId'>;
|
||||||
let searchQuery = $derived(page.url.searchParams.get(QueryParameter.QUERY));
|
let searchQuery = $derived(page.url.searchParams.get(QueryParameter.QUERY));
|
||||||
let smartSearchEnabled = $derived(featureFlagsManager.value.smartSearch);
|
let smartSearchEnabled = $derived(featureFlagsManager.value.smartSearch);
|
||||||
let terms = $derived(searchQuery ? JSON.parse(searchQuery) : {});
|
let terms = $derived<SearchTerms>(searchQuery ? JSON.parse(searchQuery) : {});
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
// we want this to *only* be reactive on `terms`
|
// we want this to *only* be reactive on `terms`
|
||||||
@@ -137,15 +137,13 @@
|
|||||||
const searchDto: SearchTerms = {
|
const searchDto: SearchTerms = {
|
||||||
page: nextPage,
|
page: nextPage,
|
||||||
withExif: true,
|
withExif: true,
|
||||||
isVisible: true,
|
|
||||||
language: $lang,
|
|
||||||
...terms,
|
...terms,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { albums, assets } =
|
const { albums, assets } =
|
||||||
('query' in searchDto || 'queryAssetId' in searchDto) && smartSearchEnabled
|
('query' in searchDto || 'queryAssetId' in searchDto) && smartSearchEnabled
|
||||||
? await searchSmart({ smartSearchDto: searchDto })
|
? await searchSmart({ smartSearchDto: { ...searchDto, language: $lang } })
|
||||||
: await searchAssets({ metadataSearchDto: searchDto });
|
: await searchAssets({ metadataSearchDto: searchDto });
|
||||||
|
|
||||||
searchResultAlbums.push(...albums.items);
|
searchResultAlbums.push(...albums.items);
|
||||||
@@ -230,7 +228,7 @@
|
|||||||
const onAlbumAddAssets = ({ assetIds }: { assetIds: string[] }) => {
|
const onAlbumAddAssets = ({ assetIds }: { assetIds: string[] }) => {
|
||||||
cancelMultiselect(assetInteraction);
|
cancelMultiselect(assetInteraction);
|
||||||
|
|
||||||
if (terms.isNotInAlbum.toString() == 'true') {
|
if (terms.isNotInAlbum) {
|
||||||
const assetIdSet = new Set(assetIds);
|
const assetIdSet = new Set(assetIds);
|
||||||
searchResultAssets = searchResultAssets.filter((asset) => !assetIdSet.has(asset.id));
|
searchResultAssets = searchResultAssets.filter((asset) => !assetIdSet.has(asset.id));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user