From 911d535f5693f4b81777c29a3282d47fd7db46c5 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 6 Jun 2026 13:45:03 -0400 Subject: [PATCH] fix(artists): card preview dead-space + empty-state flicker on first load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two operator-reported Artists-view bugs. Layout: ArtistCard previews used aspect-ratio: 3/1 + max-height: 220px — when a lone grid column got wide (>~660px), the max-height made the aspect-ratio box shrink its own WIDTH to keep the ratio, leaving dead space beside the 3 thumbnails. Dropped max-height (kept the min-height floor) so the strip fills the card width; lowered the grid min 440→360px so a lone column stays <732px (strip ≲244px) and desktop gets 2+ columns. Flicker: isEmpty checked !loading, but on the first render loading is still false (the initial loadMore fires in onMounted, after paint) so "No artists match" flashed for a frame before the spinner/data. Added a reactive `loaded` flag (true after the first load attempt, reset on reset()); isEmpty now also requires it. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/src/components/discovery/ArtistCard.vue | 8 +++++--- frontend/src/stores/artistDirectory.js | 9 ++++++++- frontend/src/views/ArtistsView.vue | 8 +++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/discovery/ArtistCard.vue b/frontend/src/components/discovery/ArtistCard.vue index dc2f5ae..813aeda 100644 --- a/frontend/src/components/discovery/ArtistCard.vue +++ b/frontend/src/components/discovery/ArtistCard.vue @@ -49,9 +49,11 @@ function onCardClick() { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; aspect-ratio: 3 / 1; - /* Explicit floor + ceiling so tall source images can't escape the - preview slot even on browsers where aspect-ratio doesn't compute. */ - min-height: 150px; max-height: 220px; + /* Floor so tall source images can't escape the slot. NO max-height: an + aspect-ratio box capped by max-height shrinks its own WIDTH to keep the + ratio, leaving dead space beside the previews on a wide (single-column) + card. The grid below keeps columns ≲400px so the strip stays a sane height. */ + min-height: 120px; overflow: hidden; background: rgb(var(--v-theme-surface-light)); } diff --git a/frontend/src/stores/artistDirectory.js b/frontend/src/stores/artistDirectory.js index baede1d..950be2f 100644 --- a/frontend/src/stores/artistDirectory.js +++ b/frontend/src/stores/artistDirectory.js @@ -14,6 +14,10 @@ export const useArtistDirectoryStore = defineStore('artistDirectory', () => { const q = ref('') const platform = ref(null) let started = false + // Has a load ATTEMPT completed yet? Gates the "No artists match" empty state + // so it can't flash on the very first render (loading is still false before + // onMounted fires the first loadMore) or between a query change and its fetch. + const loaded = ref(false) // Typed "alice" then "alice bob" used to drop the second fetch // entirely (loading flag still true from the first), so the UI // showed alice results while the input said "alice bob". Inflight @@ -35,6 +39,7 @@ export const useArtistDirectoryStore = defineStore('artistDirectory', () => { nextCursor.value = body.next_cursor started = true }) + if (t.isCurrent()) loaded.value = true } async function reset() { @@ -42,6 +47,7 @@ export const useArtistDirectoryStore = defineStore('artistDirectory', () => { cards.value = [] nextCursor.value = null started = false + loaded.value = false await loadMore() } @@ -50,7 +56,8 @@ export const useArtistDirectoryStore = defineStore('artistDirectory', () => { const hasMore = computed(() => !started || nextCursor.value !== null) const isEmpty = computed( - () => !loading.value && cards.value.length === 0 && error.value === null + () => loaded.value && !loading.value + && cards.value.length === 0 && error.value === null ) return { diff --git a/frontend/src/views/ArtistsView.vue b/frontend/src/views/ArtistsView.vue index 3e3c613..f5582f3 100644 --- a/frontend/src/views/ArtistsView.vue +++ b/frontend/src/views/ArtistsView.vue @@ -76,9 +76,11 @@ onMounted(async () => { } .fc-artists__grid { display: grid; - /* min(440px, 100%) so a card never exceeds the viewport — on phones the - min-track collapses to 100% (single column) instead of overflowing. */ - grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); + /* min(360px, 100%) so a card never exceeds the viewport (phones collapse to + one column). 360 keeps a LONE column under ~732px wide, so the 3/1 preview + strip stays ≲244px tall and always fills the card width (no dead space), + while giving 2+ columns on a normal desktop. */ + grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 12px; } .fc-artists__sentinel {