Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.
TypeScript albumsexif-extractiongeocodinglive-photomotion-photophoto-galleryphoto-sharingwebgl-viewer
fix(gallery): queue close requests during viewer opening
Timothy Yin236d7f284519
diff --git a/packages/gallery/app/components/photo/Viewer.vue b/packages/gallery/app/components/photo/Viewer.vueindex 30ddd53d..034072da 100644--- a/packages/gallery/app/components/photo/Viewer.vue+++ b/packages/gallery/app/components/photo/Viewer.vue@@ -95,6 +95,8 @@ const { convertMovToMp4, getProcessingState } = useLivePhotoProcessor()// Computedconst currentPhoto = computed(() => props.photos[props.currentIndex])const isTransitioning = ref(false)+let isOpening = false+let closeQueued = falselet transitionImage: HTMLImageElement | undefinedlet transitionAnimation: Animation | undefinedlet restoreSourceVisibility: (() => void) | undefined@@ -198,7 +200,12 @@ const animatePhoto = async (closing = false, onStart?: () => void) => {}const requestClose = async () => {- if (!props.isOpen || isTransitioning.value) return+ if (!props.isOpen) return+ if (isOpening) {+ closeQueued = true+ return+ }+ if (isTransitioning.value) returnlet closed = falseconst close = () => {if (closed) return@@ -217,7 +224,11 @@ const requestClose = async () => {watch(() => props.isOpen,async (open) => {- if (!open) return+ if (!open) {+ closeQueued = false+ return+ }+ isOpening = trueisTransitioning.value = truetry {await nextTick()@@ -226,7 +237,11 @@ watch()if (props.isOpen) await animatePhoto()} finally {+ isOpening = falseisTransitioning.value = false+ const shouldClose = closeQueued && props.isOpen+ closeQueued = false+ if (shouldClose) await requestClose()}},)