File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
apps/app-frontend/src/store Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,24 @@ export const useInstall = defineStore('installStore', {
4242} )
4343
4444export 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 ) {
You can’t perform that action at this time.
0 commit comments