Prevent empty favs tag

This commit is contained in:
Sam Becker 2023-12-31 21:44:40 -05:00
parent 0f632fe236
commit 4c3c2a73ef

View File

@ -5,13 +5,13 @@ import {
getUniqueTagsCached,
} from '@/cache';
import { SHOW_FILM_SIMULATIONS } from '@/site/config';
import { TAG_FAVS, Tags } from '@/tag';
import { TAG_FAVS } from '@/tag';
export const getPhotoSidebarDataCached = () => [
getPhotosCountCached(),
getUniqueTagsCached().then(tags =>
([tags.find(({ tag }) => tag === TAG_FAVS) ?? []] as Tags)
.concat(tags.filter(({ tag }) => tag !== TAG_FAVS))),
tags.filter(({ tag }) => tag === TAG_FAVS).concat(
tags.filter(({ tag }) => tag !== TAG_FAVS))),
getUniqueCamerasCached(),
SHOW_FILM_SIMULATIONS ? getUniqueFilmSimulationsCached() : [],
] as const;