Skip to content

Commit 1dcb38c

Browse files
authored
Fix dependency installation not respecting mod loader (#4751)
* Fix dependency installation not respecting mod loader * fix
1 parent 98b4970 commit 1dcb38c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/app-frontend/src/store/install.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,24 @@ export const useInstall = defineStore('installStore', {
4242
})
4343

4444
export const findPreferredVersion = (versions, project, instance) => {
45+
// When `project` is passed in from this stack trace:
46+
// - `installVersionDependencies`
47+
// - `install.js/install` - `installVersionDependencies` call
48+
//
49+
// ..then `project` is actually a `Dependency` struct of a cached `Version`.
50+
// `Dependency` does not have a `project_type` field,
51+
// so we default it to `mod`.
52+
//
53+
// If we don't default here, then this `.find` will ignore version/instance
54+
// loader mismatches, and you'll end up e.g. installing NeoForge mods for a
55+
// Fabric instance.
56+
const projectType = project.project_type ?? 'mod'
57+
4558
// If we can find a version using strictly the instance loader then prefer that
4659
let version = versions.find(
4760
(v) =>
4861
v.game_versions.includes(instance.game_version) &&
49-
(project.project_type === 'mod' ? v.loaders.includes(instance.loader) : true),
62+
(projectType === 'mod' ? v.loaders.includes(instance.loader) : true),
5063
)
5164

5265
if (!version) {

0 commit comments

Comments
 (0)