fix: fix empty string in gpus_in_use settings to select the correct variant
This commit is contained in:
parent
fe6412e1d4
commit
55ad2f3931
@ -53,7 +53,7 @@ export const useSettings = () => {
|
||||
const settings = await readSettings()
|
||||
if (runMode != null) settings.run_mode = runMode
|
||||
if (notify != null) settings.notify = notify
|
||||
if (gpusInUse != null) settings.gpus_in_use = gpusInUse
|
||||
if (gpusInUse != null) settings.gpus_in_use = gpusInUse.filter((e) => !!e)
|
||||
if (vulkan != null) {
|
||||
settings.vulkan = vulkan
|
||||
// GPU enabled, set run_mode to 'gpu'
|
||||
|
||||
@ -207,7 +207,12 @@ const Advanced = () => {
|
||||
let updatedGpusInUse = [...gpusInUse]
|
||||
if (updatedGpusInUse.includes(gpuId)) {
|
||||
updatedGpusInUse = updatedGpusInUse.filter((id) => id !== gpuId)
|
||||
if (gpuEnabled && updatedGpusInUse.length === 0) {
|
||||
if (
|
||||
gpuEnabled &&
|
||||
updatedGpusInUse.length === 0 &&
|
||||
gpuId &&
|
||||
gpuId.trim()
|
||||
) {
|
||||
// Vulkan support only allow 1 active device at a time
|
||||
if (vulkanEnabled) {
|
||||
updatedGpusInUse = []
|
||||
@ -219,10 +224,10 @@ const Advanced = () => {
|
||||
if (vulkanEnabled) {
|
||||
updatedGpusInUse = []
|
||||
}
|
||||
updatedGpusInUse.push(gpuId)
|
||||
if (gpuId && gpuId.trim()) updatedGpusInUse.push(gpuId)
|
||||
}
|
||||
setGpusInUse(updatedGpusInUse)
|
||||
await saveSettings({ gpusInUse: updatedGpusInUse })
|
||||
await saveSettings({ gpusInUse: updatedGpusInUse.filter((e) => !!e) })
|
||||
// Reload window to apply changes
|
||||
// This will trigger engine servers to restart
|
||||
window.location.reload()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user