fix jitter caused by gallery navigation reloading

This commit is contained in:
lightling 2024-03-21 01:26:37 -04:00
parent d316fcd592
commit c6f8032918

View file

@ -28,13 +28,14 @@ const router = useRouter()
let config: GalleryList = null!
const ready = ref(false)
const galleryReady = ref(false)
const entries = ref({} as GalleryEntries)
const variants = ref(validateVariants(props.variants))
const hasWarnings = ref(false)
const hideWarnings = defineModel('showWarnings', { type: Boolean })
const onDisplayEntries = () => {
ready.value = false
galleryReady.value = false
let currentEntries = config.entries
if (!!variants.value) {
variants.value.forEach((variant) => {
@ -43,7 +44,7 @@ const onDisplayEntries = () => {
}
entries.value = currentEntries
hasWarnings.value = !!Object.values(entries.value).find(other => !!other.warning)
setTimeout(() => ready.value = true)
setTimeout(() => galleryReady.value = true)
}
const onTileClicked = (clickEvent: { event: Event, id: string }) => {
@ -87,6 +88,7 @@ onMounted(async () => {
document.title = routeConfig.title
hideWarnings.value = storage.read(`${storageId}::hideWarnings`) || false
onDisplayEntries()
ready.value = true
})
</script>
@ -115,7 +117,7 @@ onMounted(async () => {
)
Transition
.gallery(
v-if='ready'
v-if='galleryReady'
)
GalleryTile(
v-for='(entry, id) in entries'