Skip to content

Commit cfbdc4d

Browse files
authored
[Fix] Sideload: Don't update game settings if we're in editMode (#3848)
Don't update game settings if we're in editMode EditMode hides the Wine prefix/version / CrossOver bottle selector and also doesn't set it, so clicking "Finish" resets them to their default values
1 parent 6eecf22 commit cfbdc4d

File tree

1 file changed

+17
-27
lines changed
  • src/frontend/screens/Library/components/InstallModal/SideloadDialog

1 file changed

+17
-27
lines changed

src/frontend/screens/Library/components/InstallModal/SideloadDialog/index.tsx

+17-27
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,14 @@ export default function SideloadDialog({
114114
}
115115
}, [])
116116

117+
// Suggest default Wine prefix if we're adding a new app
117118
useEffect(() => {
118-
const setWine = async () => {
119-
if (editMode && appName) {
120-
const appSettings = await window.api.getGameSettings(
121-
appName,
122-
'sideload'
123-
)
124-
if (appSettings?.winePrefix) {
125-
setWinePrefix(appSettings.winePrefix)
126-
}
127-
return
128-
} else {
129-
const { defaultWinePrefix } = await window.api.requestAppSettings()
130-
const sugestedWinePrefix = `${defaultWinePrefix}/${title}`
131-
setWinePrefix(sugestedWinePrefix)
132-
}
133-
}
134-
setWine()
135-
}, [title])
119+
if (editMode) return
120+
window.api.requestAppSettings().then(({ defaultWinePrefix }) => {
121+
const suggestedWinePrefix = `${defaultWinePrefix}/${title}`
122+
setWinePrefix(suggestedWinePrefix)
123+
})
124+
}, [title, editMode])
136125

137126
async function searchImage() {
138127
setSearching(true)
@@ -181,15 +170,16 @@ export default function SideloadDialog({
181170
if (!gameSettings) {
182171
return
183172
}
184-
await writeConfig({
185-
appName: app_name,
186-
config: {
187-
...gameSettings,
188-
winePrefix,
189-
wineVersion,
190-
wineCrossoverBottle: crossoverBottle
191-
}
192-
})
173+
if (!editMode)
174+
window.api.writeConfig({
175+
appName: app_name,
176+
config: {
177+
...gameSettings,
178+
winePrefix,
179+
wineVersion,
180+
wineCrossoverBottle: crossoverBottle
181+
}
182+
})
193183

194184
await refreshLibrary({
195185
library: 'sideload',

0 commit comments

Comments
 (0)