Skip to content

A self-hosted media server and file management system

fix: home spotlight flashes through content during load

aminnausin8547a6ccf946
diff --git a/resources/js/components/home/HomeSpotlight.vue b/resources/js/components/home/HomeSpotlight.vue
index e4cfdfcd..eb5fa08d 100644
--- a/resources/js/components/home/HomeSpotlight.vue
+++ b/resources/js/components/home/HomeSpotlight.vue
@@ -21,6 +21,7 @@ let remaining = props.intervalMs;
const activeIndex = ref(0);
const isPaused = ref(false);
+const hasMounted = ref(false);
const activeItem = computed(() => props.items[activeIndex.value] ?? null);
const activeFolder = computed(() => activeItem.value?.folder ?? null);
@@ -76,10 +77,14 @@ const goTo = (index: number) => {
};
watch(isPaused, (paused) => (paused ? pause() : start()));
-watch(activeIndex, reset);
-
-onMounted(start);
+watch(activeIndex, () => {
+ if (hasMounted.value) reset();
+});
+onMounted(() => {
+ hasMounted.value = true;
+ start();
+});
onBeforeUnmount(() => timer && clearTimeout(timer));
</script>
@@ -109,7 +114,7 @@ onBeforeUnmount(() => timer && clearTimeout(timer));
@mouseenter="isPaused = true"
@mouseleave="isPaused = false"
>
- <Transition name="banner-fade">
+ <Transition :name="hasMounted ? 'banner-fade' : ''">
<div :key="activeFolder?.id" class="absolute inset-0">
<LazyImage :src="bannerSrc" :alt="activeFolder?.title" class="size-full rounded-xl object-cover" loading="eager" decoding="async" />
@@ -168,8 +173,8 @@ onBeforeUnmount(() => timer && clearTimeout(timer));
<div class="absolute top-0 right-0 flex gap-1 p-3">
<ButtonOverlay
:class="
- cn('size-7', 'hocus:opacity-100 hocus:ease-out opacity-0 ease-in', 'hocus:outline-white outline outline-transparent', {
- 'opacity-100 ease-out': isPaused,
+ cn('size-7', 'hocus:opacity-100 hocus:ease-out opacity-0 ease-in', 'outline outline-transparent focus-visible:outline-white', {
+ 'opacity-60 ease-out': isPaused,
})
"
:title="isPaused ? 'Unpause' : 'Pause'"
diff --git a/resources/js/views/HomeView.vue b/resources/js/views/HomeView.vue
index 0d23797b..e5b19b63 100644
--- a/resources/js/views/HomeView.vue
+++ b/resources/js/views/HomeView.vue
@@ -45,6 +45,8 @@ const spotlightItems = computed(() =>
),
);
+const isLoadingSpotlight = computed(() => isLoadingRecentlyUpdated.value || isLoadingRecentlyAdded.value || isLoadingRecentlyReleased.value);
+
onMounted(() => {
pageTitle.value = 'Explore';
if (getScreenSizeRank() >= 3) useAppStore().cycleSideBar('feed', 'list-card');
@@ -55,11 +57,7 @@ onMounted(() => {
<LayoutBase>
<template #content>
<div id="content-home" class="page-height @container flex flex-col gap-8 text-sm">
- <HomeSpotlight
- v-if="spotlightItems.length"
- :items="spotlightItems"
- :is-loading="isLoadingRecentlyUploaded || isLoadingRecentlyAdded || isLoadingRecentlyReleased"
- />
+ <HomeSpotlight v-if="spotlightItems.length || isLoadingSpotlight" :items="spotlightItems" :is-loading="isLoadingSpotlight" />
<HomeShelf
v-if="isLoadingContinueWatching || !!continueWatching?.length"