diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index bf28acf2d57..d45ccb5b7a6 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -12,6 +12,7 @@ export default defineNuxtConfig({ port: 8443, host: "0.0.0.0", }, + devtools: { enabled: true }, imports: { autoImport: false, }, diff --git a/frontend/shared/types/fetch-state.ts b/frontend/shared/types/fetch-state.ts index dd80cdc9e00..d12ad27f00c 100644 --- a/frontend/shared/types/fetch-state.ts +++ b/frontend/shared/types/fetch-state.ts @@ -27,9 +27,6 @@ export interface FetchingError { details?: Record } -export interface FetchState { - isFetching: boolean - hasStarted?: boolean - isFinished?: boolean - fetchingError: FetchingError | null -} +export type FetchState = + | { status: "idle" | "fetching" | "success"; error: null } + | { status: "error"; error: FetchingError } diff --git a/frontend/src/components/VCollectionHeader/VCollectionHeader.vue b/frontend/src/components/VCollectionHeader/VCollectionHeader.vue index 637a3c0e81f..2cad1aae7b0 100644 --- a/frontend/src/components/VCollectionHeader/VCollectionHeader.vue +++ b/frontend/src/components/VCollectionHeader/VCollectionHeader.vue @@ -89,16 +89,12 @@ const showCollectionExternalLink = computed(() => { return Boolean(props.collectionParams.collection !== "tag" && url.value) }) -const { getI18nCollectionResultCountLabel } = useI18nResultsCount() +const showLoading = computed(() => mediaStore.showLoading) +const { getI18nCollectionResultCountLabel } = useI18nResultsCount(showLoading) const resultsLabel = computed(() => { - if (mediaStore.resultCount === 0 && mediaStore.fetchState.isFetching) { - return "" - } - const resultsCount = mediaStore.results[props.mediaType].count - return getI18nCollectionResultCountLabel( - resultsCount, + mediaStore.results[props.mediaType].count, props.mediaType, props.collectionParams.collection ) diff --git a/frontend/src/components/VCollectionHeader/meta/VCollectionHeader.stories.ts b/frontend/src/components/VCollectionHeader/meta/VCollectionHeader.stories.ts index dd29a749a96..664c39abf0a 100644 --- a/frontend/src/components/VCollectionHeader/meta/VCollectionHeader.stories.ts +++ b/frontend/src/components/VCollectionHeader/meta/VCollectionHeader.stories.ts @@ -95,6 +95,10 @@ export const AllCollections: Omit = { const mediaStore = useMediaStore() mediaStore.$patch({ results: { image: { count: 240 } }, + mediaFetchState: { + image: { status: "success", error: null }, + audio: { status: "success", error: null }, + }, }) return () => h( diff --git a/frontend/src/components/VContentLink/VContentLink.vue b/frontend/src/components/VContentLink/VContentLink.vue index 89cb9c117f2..ad9e21827d9 100644 --- a/frontend/src/components/VContentLink/VContentLink.vue +++ b/frontend/src/components/VContentLink/VContentLink.vue @@ -1,43 +1,29 @@