mirror of
https://github.com/modrinth/code.git
synced 2026-07-31 13:16:38 +00:00
fix: download modal suggested dep can use wrong mc version (#6925)
This commit is contained in:
@@ -86,10 +86,17 @@ export function provideDownloadModalProvider(
|
||||
const tags = useGeneratedState()
|
||||
|
||||
const shouldResolveDependencies = computed(
|
||||
() => !!options.project.value && !!options.selectedVersion.value,
|
||||
() =>
|
||||
!!options.project.value &&
|
||||
!!options.selectedVersion.value &&
|
||||
!!options.currentGameVersion.value,
|
||||
)
|
||||
const dependencyResolutionPreferences = computed(() =>
|
||||
createResolutionPreferences(options.selectedVersion.value, options.currentPlatform.value),
|
||||
createResolutionPreferences(
|
||||
options.selectedVersion.value,
|
||||
options.currentGameVersion.value,
|
||||
options.currentPlatform.value,
|
||||
),
|
||||
)
|
||||
|
||||
const { data: dependencyResolution, isFetching: dependencyResolutionFetching } = useQuery({
|
||||
@@ -309,10 +316,12 @@ export function provideDownloadModalProvider(
|
||||
})
|
||||
|
||||
async function preloadDependenciesForSelection(selection: ProjectDownloadSelection) {
|
||||
if (!options.project.value || !selection.selectedVersion) return
|
||||
if (!options.project.value || !selection.selectedVersion || !selection.currentGameVersion)
|
||||
return
|
||||
|
||||
const preferences = createResolutionPreferences(
|
||||
selection.selectedVersion,
|
||||
selection.currentGameVersion,
|
||||
selection.currentPlatform,
|
||||
)
|
||||
|
||||
@@ -548,10 +557,11 @@ function dependencyProjectsQueryOptions(
|
||||
|
||||
function createResolutionPreferences(
|
||||
version: Labrinth.Versions.v3.Version | null,
|
||||
currentGameVersion: string | null,
|
||||
currentPlatform: string | null,
|
||||
): Labrinth.Content.v3.ResolutionPreferences {
|
||||
return {
|
||||
game_versions: version?.game_versions || [],
|
||||
game_versions: currentGameVersion ? [currentGameVersion] : [],
|
||||
loaders: currentPlatform ? [currentPlatform] : version?.loaders || [],
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user