Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(tours): dismiss tour immediately and lazy-load driver.js

Timothy Yin496abb6279ad
diff --git a/app/components/AdminTours.client.vue b/app/components/AdminTours.client.vue
index 2bee73f5..13cfb4fd 100644
--- a/app/components/AdminTours.client.vue
+++ b/app/components/AdminTours.client.vue
@@ -1,6 +1,5 @@
<script setup lang="ts">
-import { driver, type Driver, type DriveStep } from 'driver.js'
-import 'driver.js/dist/driver.css'
+import type { Driver, DriveStep } from 'driver.js'
import { tourIds, type TourId } from '~~/shared/types/tours'
const route = useRoute()
const { user } = useUserSession()
@@ -140,17 +139,18 @@ async function start() {
]
})
if (!steps.length) return
+ const [{ driver }] = await Promise.all([
+ import('driver.js'),
+ import('driver.js/dist/driver.css'),
+ ])
+ if (token !== generation) return
let saving = false
async function finish(status: 'completed' | 'skipped') {
if (saving) return
saving = true
- const tour = active
- const saved = await update(id as TourId, status)
- saving = false
- if (!saved) {
- tour?.destroy()
- if (active === tour) active = undefined
- } else if (token === generation) stop()
+ // Dismiss immediately so a slow status request cannot block the page.
+ stop()
+ await update(id as TourId, status)
}
active = driver({
steps,