Skip to content

Commit

Permalink
fix(market): fix market refresh, close koishijs#189
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jun 23, 2023
1 parent fd3a64f commit cba5e92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions plugins/market/client/components/package.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</td>

<td>
<el-select v-if="!local.workspace && !local.invalid" v-model="version">
<el-select v-if="data" v-model="version">
<el-option value="">移除依赖</el-option>
<el-option v-for="({ result }, version) in data" :key="version" :value="version">
{{ version }}
Expand All @@ -25,7 +25,7 @@

<td>
<template v-if="local.invalid">暂不支持</template>
<el-button v-else-if="local.workspace || remote" @click="active = name">修改</el-button>
<el-button v-else-if="local.workspace || versions" @click="active = name">修改</el-button>
<template v-else>版本获取失败</template>
</td>
</tr>
Expand All @@ -44,7 +44,7 @@ const props = defineProps({
})
const local = computed(() => store.dependencies[props.name])
const remote = computed(() => store.registry[props.name])
const versions = computed(() => store.registry[props.name])
const compare = computed(() => {
if (local.value.invalid) return
Expand All @@ -71,7 +71,10 @@ const version = computed({
},
})
const data = computed(() => analyzeVersions(props.name))
const data = computed(() => {
if (local.value.workspace || local.value.invalid) return
return analyzeVersions(props.name)
})
</script>

Expand Down
1 change: 0 additions & 1 deletion plugins/market/src/node/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class RegistryProvider extends DataService<Dict<Dict<Pick<RemotePackage, Depende
}

flushData = throttle(500, () => {
console.log(this.ctx.installer.tempCache)
this.ctx.console.broadcast('market/registry', this.ctx.installer.tempCache)
this.ctx.installer.tempCache = {}
})
Expand Down
2 changes: 1 addition & 1 deletion plugins/market/src/node/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ class Installer extends Service {
}

refresh(refresh = false) {
this.depTask = null
this.pkgTasks = {}
this.fullCache = {}
this.tempCache = {}
this.depTask = this._getDeps()
if (!refresh) return
this.ctx.console.registry?.refresh()
this.ctx.console.packages?.refresh()
Expand Down

0 comments on commit cba5e92

Please sign in to comment.