diff --git a/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue b/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue index 1a01aa90d5..e60e3493ed 100644 --- a/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue +++ b/apps/frontend/src/components/ui/ProjectDownloadModal/DownloadProject.vue @@ -80,7 +80,7 @@ -
+

[], dependencyDownloadFiles: () => [], + downloadDataLoaded: false, downloadReason: 'standalone', initialGameVersion: null, initialPlatform: null, diff --git a/apps/frontend/src/components/ui/ProjectDownloadModal/download-modal-provider.ts b/apps/frontend/src/components/ui/ProjectDownloadModal/download-modal-provider.ts index 567dc8bf95..5a183d1cd9 100644 --- a/apps/frontend/src/components/ui/ProjectDownloadModal/download-modal-provider.ts +++ b/apps/frontend/src/components/ui/ProjectDownloadModal/download-modal-provider.ts @@ -52,6 +52,7 @@ export interface ProjectDownloadSelection { interface DownloadModalProviderOptions { project: ComputedRef selectedVersion: ComputedRef + selectedPrimaryFile: ComputedRef currentGameVersion: ComputedRef currentPlatform: ComputedRef downloadReason: ComputedRef @@ -62,6 +63,7 @@ export interface DownloadModalProvider { visibleDependencyRows: ComputedRef duplicateDependencyRowsHidden: ComputedRef downloadRows: ComputedRef + downloadRowsLoaded: ComputedRef downloadableDependencyFiles: ComputedRef downloadableDependencyFilesLoaded: ComputedRef preloadDependenciesForSelection: (selection: ProjectDownloadSelection) => Promise @@ -187,6 +189,11 @@ export function provideDownloadModalProvider( return true }) + const downloadRowsLoaded = computed(() => { + if (!options.selectedPrimaryFile.value) return false + return dependenciesLoaded.value + }) + const resolvedDependencyRows = computed(() => { if (!dependenciesLoaded.value) return [] @@ -207,37 +214,40 @@ export function provideDownloadModalProvider( ) const duplicateDependencyRowsHidden = computed(() => - hasSkippedDuplicateDependency(dependencyResolution.value) || - hasDuplicateDependencyRows(resolvedDependencyRows.value), + downloadRowsLoaded.value && + (hasSkippedDuplicateDependency(dependencyResolution.value) || + hasDuplicateDependencyRows(resolvedDependencyRows.value)), ) const additionalFileRows = computed(() => - options.additionalFiles.value.map((file) => ({ - key: `additional-file-${additionalFileKey(file)}`, - name: file.filename, - fallbackIcon: FileIcon, - downloadHref: getDownloadUrl(file.url), - filename: file.filename, - fileSize: file.size, - metadataLabel: fileTypeLabel(file.file_type), - typeLabel: fileTypeLabel(file.file_type), - unavailableTooltip: formatMessage(messages.unavailableFile), - dependencies: [], - })), + downloadRowsLoaded.value + ? options.additionalFiles.value.map((file) => ({ + key: `additional-file-${additionalFileKey(file)}`, + name: file.filename, + fallbackIcon: FileIcon, + downloadHref: getDownloadUrl(file.url), + filename: file.filename, + fileSize: file.size, + metadataLabel: fileTypeLabel(file.file_type), + typeLabel: fileTypeLabel(file.file_type), + unavailableTooltip: formatMessage(messages.unavailableFile), + dependencies: [], + })) + : [], ) - const downloadRows = computed(() => [ - ...visibleDependencyRows.value, - ...additionalFileRows.value, - ]) + const downloadRows = computed(() => + downloadRowsLoaded.value + ? [...visibleDependencyRows.value, ...additionalFileRows.value] + : [], + ) const downloadableDependencyFiles = computed(() => collectDownloadableDependencyFiles(visibleDependencyRows.value), ) const downloadableDependencyFilesLoaded = computed(() => { - if (!shouldResolveDependencies.value) return false - return dependenciesLoaded.value + return downloadRowsLoaded.value }) async function preloadDependenciesForSelection(selection: ProjectDownloadSelection) { @@ -355,6 +365,7 @@ export function provideDownloadModalProvider( visibleDependencyRows, duplicateDependencyRowsHidden, downloadRows, + downloadRowsLoaded, downloadableDependencyFiles, downloadableDependencyFilesLoaded, preloadDependenciesForSelection, diff --git a/apps/frontend/src/components/ui/ProjectDownloadModal/index.vue b/apps/frontend/src/components/ui/ProjectDownloadModal/index.vue index 1196404235..cb2be6dbc7 100644 --- a/apps/frontend/src/components/ui/ProjectDownloadModal/index.vue +++ b/apps/frontend/src/components/ui/ProjectDownloadModal/index.vue @@ -19,6 +19,7 @@ :project="project" :versions="versions" :dependency-download-files="dependencyDownloadFiles" + :download-data-loaded="downloadRowsLoaded" :download-reason="downloadReason" :initial-game-version="initialGameVersion" :initial-platform="initialPlatform" @@ -271,6 +272,7 @@ const additionalFiles = computed(() => { const downloadModalProvider = provideDownloadModalProvider({ project, selectedVersion, + selectedPrimaryFile, currentGameVersion, currentPlatform, downloadReason: computed(() => props.downloadReason), @@ -278,6 +280,7 @@ const downloadModalProvider = provideDownloadModalProvider({ }) const dependencyDownloadFiles = downloadModalProvider.downloadableDependencyFiles const dependencyDownloadFilesLoaded = downloadModalProvider.downloadableDependencyFilesLoaded +const downloadRowsLoaded = downloadModalProvider.downloadRowsLoaded const selectedVersionDownloadFiles = computed(() => { if (!selectedVersion.value) return []