Skip to content

fix(market): keep the install dialog alive when the version isn't in data - #371

Open
PerryLink wants to merge 1 commit into
koishijs:mainfrom
PerryLink:fix/market-install-dialog-typeerror
Open

PerryLink wants to merge 1 commit into
koishijs:mainfrom
PerryLink:fix/market-install-dialog-typeerror

Conversation

@PerryLink

Copy link
Copy Markdown

What

plugins/market/client/components/install.vue no longer throws when the selected version is not a key of the analysed version map.

Before:

const { result } = data.value[version.value]

After:

const { result } = data.value[version.value] ?? {}

Why

When a plugin is installed as a local file: dependency, watch(active) seeds version.value from store.dependencies[active].request, so it holds the raw spec, e.g. file:./koishi-plugin-hds-interlude.

data comes from analyzeVersions(), which is keyed by market-registry versions (1.0.0, 1.1.0, …). The lookup returns undefined, and destructuring it throws TypeError: Cannot destructure property 'result' ... as it is undefined.

result is a lazy computed read during rendering, at :type="result" inside <template v-else-if="data">, so the exception aborts the render and the dialog closes as soon as it opens. Neighbouring reads already guard this case (data.value?.[version.value]), so this looks like an oversight.

Fixes koishijs/koishi#1550.

Validation

  • git apply --check --cached patch.diff against main (blob 963bece) — applies cleanly.
  • Reproduced on the real Vue runtime (3.5.43) and render pipeline via createRenderer: driving the computed from a file: version, HEAD throws the TypeError plus [Vue warn]: Unhandled error during execution of render function; with ?? {} the render completes.

Not verified: the end-to-end console flow against a live market registry, which needs the reporter's environment. This only stops the crash; the intended UX for file: dependencies is still open.

@PerryLink
PerryLink force-pushed the fix/market-install-dialog-typeerror branch from 92b6fed to f7357cb Compare September 19, 2026 11:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: plugin-market: 点击file:本地依赖插件的“修改”按钮时弹窗立即关闭并抛出 TypeError

1 participant