fix: update button enabling its package

This commit is contained in:
2025-05-01 16:32:10 +00:00
parent 2e17e0ae75
commit 9b86af282e
11 changed files with 81 additions and 33 deletions

View File

@ -189,7 +189,7 @@ export const usePkgStore = defineStore('pkg', {
await this.reloadAll();
},
async install(pkg: Package | undefined) {
async install(pkg: Package | undefined, enable: boolean) {
if (pkg === undefined) {
return;
}
@ -198,6 +198,7 @@ export const usePkgStore = defineStore('pkg', {
await invoke('install_package', {
key: pkgKey(pkg),
force: true,
enable,
});
} catch (err) {
if (pkg !== undefined) {
@ -211,6 +212,7 @@ export const usePkgStore = defineStore('pkg', {
await invoke('install_package', {
key,
force: true,
enable: false,
});
} catch (err) {
console.error(err);
@ -221,7 +223,7 @@ export const usePkgStore = defineStore('pkg', {
const list = [];
for (const pkg of this.allLocal) {
if (pkg.rmt && pkg.rmt.version > pkg.loc!.version) {
list.push(this.install(pkg));
list.push(this.install(pkg, false));
}
}
await Promise.all(list);