Skip to content

Commit a8dcfa8

Browse files
authored
fix: download modal suggested dep can use wrong mc version (#6925)
1 parent 0f6a74b commit a8dcfa8

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

apps/frontend/src/components/ui/ProjectDownloadModal/download-modal-provider.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,17 @@ export function provideDownloadModalProvider(
8686
const tags = useGeneratedState()
8787

8888
const shouldResolveDependencies = computed(
89-
() => !!options.project.value && !!options.selectedVersion.value,
89+
() =>
90+
!!options.project.value &&
91+
!!options.selectedVersion.value &&
92+
!!options.currentGameVersion.value,
9093
)
9194
const dependencyResolutionPreferences = computed(() =>
92-
createResolutionPreferences(options.selectedVersion.value, options.currentPlatform.value),
95+
createResolutionPreferences(
96+
options.selectedVersion.value,
97+
options.currentGameVersion.value,
98+
options.currentPlatform.value,
99+
),
93100
)
94101

95102
const { data: dependencyResolution, isFetching: dependencyResolutionFetching } = useQuery({
@@ -309,10 +316,12 @@ export function provideDownloadModalProvider(
309316
})
310317

311318
async function preloadDependenciesForSelection(selection: ProjectDownloadSelection) {
312-
if (!options.project.value || !selection.selectedVersion) return
319+
if (!options.project.value || !selection.selectedVersion || !selection.currentGameVersion)
320+
return
313321

314322
const preferences = createResolutionPreferences(
315323
selection.selectedVersion,
324+
selection.currentGameVersion,
316325
selection.currentPlatform,
317326
)
318327

@@ -548,10 +557,11 @@ function dependencyProjectsQueryOptions(
548557

549558
function createResolutionPreferences(
550559
version: Labrinth.Versions.v3.Version | null,
560+
currentGameVersion: string | null,
551561
currentPlatform: string | null,
552562
): Labrinth.Content.v3.ResolutionPreferences {
553563
return {
554-
game_versions: version?.game_versions || [],
564+
game_versions: currentGameVersion ? [currentGameVersion] : [],
555565
loaders: currentPlatform ? [currentPlatform] : version?.loaders || [],
556566
}
557567
}

0 commit comments

Comments
 (0)