Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
)

Expand Down Expand Up @@ -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 || [],
}
}
Expand Down
Loading