Skip to content

Commit

Permalink
fix: The instance install dialog does not closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Aug 26, 2024
1 parent cd46410 commit 26cdc21
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions xmcl-keystone-ui/src/composables/instanceCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,22 @@ export function useInstanceCreation(gameProfile: Ref<GameProfile>, instances: Re
if (!data.name) {
data.name = generateDistinctName(generateBaseName(runtime), instances.value.map(i => i.name))
}
const pendingFiles = [...files.value]
const newPath = await create({
...data,
resourcepacks: files.value.some(f => f.path.startsWith('resourcepacks')),
shaderpacks: files.value.some(f => f.path.startsWith('shaderpacks')),
resourcepacks: pendingFiles.some(f => f.path.startsWith('resourcepacks')),
shaderpacks: pendingFiles.some(f => f.path.startsWith('shaderpacks')),
})
if (files.value.length > 0) {
return installInstanceFiles({
onCreated?.(newPath)
reset()
if (pendingFiles.length > 0) {
await installInstanceFiles({
path: newPath,
files: files.value,
files: pendingFiles,
}).catch((e) => {
console.error(e)
})
}
onCreated?.(newPath)
reset()
return newPath
} catch (e) {
error.value = e
Expand Down

0 comments on commit 26cdc21

Please sign in to comment.