From 00536d98a7139f7c4186d841fd8e0028faf8badc Mon Sep 17 00:00:00 2001 From: Turtle Date: Tue, 20 Oct 2026 10:20:12 +0800 Subject: [PATCH 1/4] fix(plugin-manager): return to the opening tab from a bundle page A bundle page opened from Discover now returns to Discover instead of the Installed list. Fixes #6643 --- .../client/ui-plugin-manager/README.i18n.yaml | 4 +-- packages/client/ui-plugin-manager/README.md | 2 +- .../client/ui-plugin-manager/README.zh.md | 2 +- .../src/client/PluginManagerPage.tsx | 17 +++++++---- .../src/client/navigation-store.ts | 9 ++++-- .../tests/components.client.spec.tsx | 29 +++++++++++++++++-- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml index 19a4d854bd..e0b8da9acb 100644 --- a/packages/client/ui-plugin-manager/README.i18n.yaml +++ b/packages/client/ui-plugin-manager/README.i18n.yaml @@ -36,8 +36,8 @@ en: 54d7666c630da471 zh: d7ded257d0fd5559 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/page-tabs: - en: 25451392e1118869 - zh: 8ba84f8fdbb47b3f + en: de9bc95ad579fc4e + zh: 14e74af14e0ab298 /deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation: en: 203168fc87e939bd zh: 72d0ccd2c54f3f44 diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md index 1cf636583c..74047e1a76 100644 --- a/packages/client/ui-plugin-manager/README.md +++ b/packages/client/ui-plugin-manager/README.md @@ -108,7 +108,7 @@ A row's page exists only while a `plugins.row.config` entry names the row, so a ### Page tabs -Another plugin adds a tab after the page's own **Installed** tab by registering into the `plugins.tab` list slot; the entry's `label` names the tab and `order` places it. The tabs appear under the page header once one entry exists and are hidden on a bundle's, row's, or official plugin's page; the selected tab survives leaving **Plugins**, and a tab whose entry leaves falls back to **Installed**. The page renders the selected entry in place of its groups and hides its own refresh and add buttons there. The owner props carry `install({ spec, registry?, title, version })` and `openPackage(name)`. `install` is for a version the person already confirmed in the tab: the install dialog opens at its check screen, without the spec form, names the plugin with `title` and `version` above the spec, which it shows in smaller monospace text, keeps that name on the progress and result screens, with the installed version once done, asks `registry` first for that install only and never remembers it, and offers **Retry** after a refusal; a hidden installation reopens instead. `openPackage` switches to **Installed** and opens the bundle's page when that tab lists it; a bundle the page leaves out, such as a built-in profile bundle, leaves the Installed list open. A confirmed install offers no GitHub mirror recovery, since that recovery reopens the spec form, and its back button cancels a running install. [`ui-plugin-market`](../ui-plugin-market/README.md) contributes the **Discover** tab here. +Another plugin adds a tab after the page's own **Installed** tab by registering into the `plugins.tab` list slot; the entry's `label` names the tab and `order` places it. The tabs appear under the page header once one entry exists and are hidden on a bundle's, row's, or official plugin's page; the selected tab survives leaving **Plugins**, and a tab whose entry leaves falls back to **Installed**. The page renders the selected entry in place of its groups and hides its own refresh and add buttons there. The owner props carry `install({ spec, registry?, title, version })` and `openPackage(name)`. `install` is for a version the person already confirmed in the tab: the install dialog opens at its check screen, without the spec form, names the plugin with `title` and `version` above the spec, which it shows in smaller monospace text, keeps that name on the progress and result screens, with the installed version once done, asks `registry` first for that install only and never remembers it, and offers **Retry** after a refusal; a hidden installation reopens instead. `openPackage` switches to **Installed** and opens the bundle's page when that tab lists it, and that page's back button returns to the tab that called it; a bundle the page leaves out, such as a built-in profile bundle, leaves the Installed list open. A confirmed install offers no GitHub mirror recovery, since that recovery reopens the spec form, and its back button cancels a running install. [`ui-plugin-market`](../ui-plugin-market/README.md) contributes the **Discover** tab here. ----- diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md index b6e5e58b03..1a0b9380f6 100644 --- a/packages/client/ui-plugin-manager/README.zh.md +++ b/packages/client/ui-plugin-manager/README.zh.md @@ -108,7 +108,7 @@ ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({ ### 页面标签页 -其他插件向 `plugins.tab` 列表 slot 注册条目,即可在页面自带的**已安装**标签页之后添加一个标签页;条目的 `label` 为标签页命名,`order` 决定其位置。至少存在一个条目时,标签页显示在页头下方;在组合包、行或官方插件的页面上隐藏。离开**插件**后,所选标签页保持不变;所选标签页的条目被移除时,回到**已安装**。页面渲染所选条目以代替自身的分组,并在此时隐藏自身的刷新和添加按钮。owner props 提供 `install({ spec, registry?, title, version })` 和 `openPackage(name)`。`install` 用于用户已在标签页中确认的版本:安装对话框在检查界面打开,不显示 spec 表单,在以较小等宽字显示的 spec 上方用 `title` 和 `version` 标明插件,并在进度和结果界面保持该名称,完成后显示已安装的版本;只在这一次安装中首先使用 `registry`,且从不记住它;被拒绝后提供**重试**;如果有隐藏中的安装任务,则改为重新打开该任务。`openPackage` 切换到**已安装**,并在该标签页列出该组合包时打开其页面;页面不列出的组合包(例如内置 profile 组合包)只打开「已安装」列表。已确认的安装不提供 GitHub 镜像恢复,因为该恢复会重新打开 spec 表单;其返回按钮用于取消正在进行的安装。[`ui-plugin-market`](../ui-plugin-market/README.zh.md) 在这里贡献**发现**标签页。 +其他插件向 `plugins.tab` 列表 slot 注册条目,即可在页面自带的**已安装**标签页之后添加一个标签页;条目的 `label` 为标签页命名,`order` 决定其位置。至少存在一个条目时,标签页显示在页头下方;在组合包、行或官方插件的页面上隐藏。离开**插件**后,所选标签页保持不变;所选标签页的条目被移除时,回到**已安装**。页面渲染所选条目以代替自身的分组,并在此时隐藏自身的刷新和添加按钮。owner props 提供 `install({ spec, registry?, title, version })` 和 `openPackage(name)`。`install` 用于用户已在标签页中确认的版本:安装对话框在检查界面打开,不显示 spec 表单,在以较小等宽字显示的 spec 上方用 `title` 和 `version` 标明插件,并在进度和结果界面保持该名称,完成后显示已安装的版本;只在这一次安装中首先使用 `registry`,且从不记住它;被拒绝后提供**重试**;如果有隐藏中的安装任务,则改为重新打开该任务。`openPackage` 切换到**已安装**,并在该标签页列出该组合包时打开其页面,该页面的返回按钮回到调用它的标签页;页面不列出的组合包(例如内置 profile 组合包)只打开「已安装」列表。已确认的安装不提供 GitHub 镜像恢复,因为该恢复会重新打开 spec 表单;其返回按钮用于取消正在进行的安装。[`ui-plugin-market`](../ui-plugin-market/README.zh.md) 在这里贡献**发现**标签页。 ----- diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx index 68ad27e43e..20c579890a 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx @@ -1577,6 +1577,10 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { const showsMainList = showsCards && !showsMoreList const installedCards = onInstalled && showsCards const openPkgInMore = openPkg !== undefined && openPkg.official && detailFromMore + // A bundle page opened from a contributed tab returns to that tab instead of the Installed lists. + const returnTab = view.kind === 'package' || view.kind === 'row' ? view.returnTab : undefined + const backToMore = openPkgInMore && returnTab === undefined + const pkgOrigin = { ...openPkgInMore ? { from: 'more' as const } : {}, ...returnTab === undefined ? {} : { returnTab } } // The Installed tab's panel, whatever it currently shows; the More list is not a tab panel. const installedPanel = tabs.length === 0 || showsMoreList ? {} @@ -1588,7 +1592,7 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { } const configure = (pkg: PackageView): RowConfigure => ({ has: row => ledger.rows.has(rowConfigKey(pkg.name, row.rowId)), - open: (row) => { setView({ kind: 'row', name: pkg.name, rowId: row.rowId, ...openPkgInMore ? { from: 'more' } : {} }) }, + open: (row) => { setView({ kind: 'row', name: pkg.name, rowId: row.rowId, ...pkgOrigin }) }, }) const updates = updatesNote(mine, state.versions, t) const updatePkg = state.update === null ? undefined : state.packages.find(pkg => pkg.name === state.update?.packageName) @@ -1683,7 +1687,7 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode {
{renderSlot('plugins.tab', { install: props.installFrom, - openPackage: (name) => { setTab(INSTALLED_TAB); setView({ kind: 'package', name }) }, + openPackage: (name) => { setTab(INSTALLED_TAB); setView({ kind: 'package', name, returnTab: tab }) }, }, { only: tab })}
) @@ -1736,7 +1740,7 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { t={t} resolveText={resolveText} renderSlot={renderSlot} - onBack={() => { setView({ kind: 'package', name: openPkg.name, ...openPkgInMore ? { from: 'more' } : {} }) }} + onBack={() => { setView({ kind: 'package', name: openPkg.name, ...pkgOrigin }) }} /> ) : null} @@ -1751,13 +1755,16 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { configured={ledger.bundles.has(openPkg.name)} configure={configure(openPkg)} renderSlot={renderSlot} - inMore={openPkgInMore} + inMore={backToMore} detail={( )} - onBack={() => { setView({ kind: openPkgInMore ? 'more' : 'list' }) }} + onBack={() => { + if (returnTab !== undefined) setTab(returnTab) + setView({ kind: backToMore ? 'more' : 'list' }) + }} onSetEnabled={(enabled) => { props.setEnabled(openPkg.name, enabled) }} onUninstall={() => { props.uninstall(openPkg.name) }} onUpdate={() => { props.update(openPkg.name) }} diff --git a/packages/client/ui-plugin-manager/src/client/navigation-store.ts b/packages/client/ui-plugin-manager/src/client/navigation-store.ts index 7327f7ceb6..e19a6b3db8 100644 --- a/packages/client/ui-plugin-manager/src/client/navigation-store.ts +++ b/packages/client/ui-plugin-manager/src/client/navigation-store.ts @@ -1,13 +1,16 @@ /** Plugin page selection shared by the page and cross-plugin navigation. */ import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-store' -/** The main or additional plugin list, or one bundle, official item, or bundle row of the Installed tab. */ +/** + * The main or additional plugin list, or one bundle, official item, or bundle row of the Installed tab. A bundle or row + * opened from a contributed tab names it in `returnTab`, and the bundle page's back returns to that tab's list. + */ type View = | { readonly kind: 'list' } | { readonly kind: 'more' } - | { readonly kind: 'package'; readonly name: string; readonly from?: 'more' } + | { readonly kind: 'package'; readonly name: string; readonly from?: 'more'; readonly returnTab?: string } | { readonly kind: 'item'; readonly id: string } - | { readonly kind: 'row'; readonly name: string; readonly rowId: string; readonly from?: 'more' } + | { readonly kind: 'row'; readonly name: string; readonly rowId: string; readonly from?: 'more'; readonly returnTab?: string } /** `installed` is the page's own tab; any other value is the id of a `plugins.tab` entry. */ type NavigationState = { view: View; tab: string } diff --git a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx index ee522a322c..cfccfca57d 100644 --- a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx +++ b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx @@ -249,10 +249,14 @@ describe('PluginManagerPage', () => { fireEvent.click(screen.getByRole('button', { name: 'Discover install' })) expect(actions.installFrom).toHaveBeenCalledWith({ spec: 'dsh-a@1.0.0', registry: 'https://r.example/', title: 'Alpha', version: '1.0.0' }) fireEvent.click(screen.getByRole('button', { name: 'Discover open' })) - expect(navigation.getSnapshot()).toEqual({ tab: 'installed', view: { kind: 'package', name: 'dsh-better-sidebar' } }) + expect(navigation.getSnapshot()).toEqual({ tab: 'installed', view: { kind: 'package', name: 'dsh-better-sidebar', returnTab: 'discover' } }) expect(document.querySelector('[data-plugin-detail="dsh-better-sidebar"]')).not.toBeNull() - // A detail page hides the tabs; a contributed tab that leaves the ledger falls back to Installed. + // A detail page hides the tabs; its back button returns to the tab that opened it. expect(screen.queryByRole('tablist')).toBeNull() + fireEvent.click(screen.getByRole('button', { name: en.backToList })) + expect(navigation.getSnapshot()).toEqual({ tab: 'discover', view: { kind: 'list' } }) + expect(screen.getByRole('tab', { name: 'Discover' }).getAttribute('aria-selected')).toBe('true') + // A contributed tab that leaves the ledger falls back to Installed. act(() => { navigation.actions.setView({ kind: 'list' }); navigation.actions.setTab('discover') }) setTabs([]) expect(document.querySelector('[data-plugin-group="bundles"]')).not.toBeNull() @@ -292,10 +296,31 @@ describe('PluginManagerPage', () => { fireEvent.click(screen.getByRole('tab', { name: 'Discover' })) fireEvent.click(screen.getByRole('button', { name: 'Discover open' })) expect(document.querySelector(`[data-plugin-detail="${worktree}"]`)).not.toBeNull() + // An official plugin of the More list opened from Discover returns to Discover, not to the More list. + fireEvent.click(screen.getByRole('button', { name: en.backToList })) + expect(navigation.getSnapshot()).toEqual({ tab: 'discover', view: { kind: 'list' } }) + act(() => { navigation.actions.setTab('installed'); navigation.actions.setView({ kind: 'package', name: worktree }) }) fireEvent.click(screen.getByRole('button', { name: en.backToPackage.replace('{name}', en.moreTitle) })) expect(screen.getByRole('heading', { name: en.moreTitle, level: 1 })).toBeTruthy() }) + it('keeps the opening tab through a row page opened from a bundle page', () => { + const { navigation } = renderTab({ packages: [pkg({ rows: [row()] })] }, { rows: new Set(['dsh-better-sidebar#sidebar']) }, { + 'plugins.tab:discover': (_view, owner) => ( + + ), + 'plugins.row.config:dsh-better-sidebar#sidebar': view => view === 'summary' ? 'Config summary' :
, + }, {}, [{ id: 'discover', label: 'Discover' }]) + fireEvent.click(screen.getByRole('tab', { name: 'Discover' })) + fireEvent.click(screen.getByRole('button', { name: 'Discover open' })) + fireEvent.click(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'dsh-better-sidebar') })) + expect(navigation.getSnapshot().view).toEqual({ kind: 'row', name: 'dsh-better-sidebar', rowId: 'sidebar', returnTab: 'discover' }) + fireEvent.click(screen.getByRole('button', { name: en.backToPackage.replace('{name}', 'dsh-better-sidebar') })) + expect(navigation.getSnapshot().view).toEqual({ kind: 'package', name: 'dsh-better-sidebar', returnTab: 'discover' }) + fireEvent.click(screen.getByRole('button', { name: en.backToList })) + expect(navigation.getSnapshot()).toEqual({ tab: 'discover', view: { kind: 'list' } }) + }) + it('shows a confirmed version by name above its spec, as a check and a refusal with retry, without the spec form or another registry', () => { const confirmed: InstallState = { ...IDLE_INSTALL, open: true, spec: 'dsh-a@1.0.0', confirmed: { title: 'Alpha', version: '1.0.0' }, registries: REGISTRIES } const { actions, set } = renderTab({ install: { ...confirmed, phase: 'checking' } }) From 39d0232581641080ac7becda5794863fbaa33b8d Mon Sep 17 00:00:00 2001 From: Turtle Date: Tue, 20 Oct 2026 10:40:26 +0800 Subject: [PATCH 2/4] fix(plugin-manager): document the return tab and keep one origin per view --- packages/client/ui-plugin-manager/README.i18n.yaml | 4 ++-- packages/client/ui-plugin-manager/README.md | 2 +- packages/client/ui-plugin-manager/README.zh.md | 2 +- .../src/client/PluginManagerPage.tsx | 3 +-- .../ui-plugin-manager/src/client/slot-contract.ts | 2 +- .../tests/components.client.spec.tsx | 14 +++++++++++--- .../src/client/slot-catalog.ts | 2 +- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml index e0b8da9acb..95038f99ce 100644 --- a/packages/client/ui-plugin-manager/README.i18n.yaml +++ b/packages/client/ui-plugin-manager/README.i18n.yaml @@ -36,8 +36,8 @@ en: 54d7666c630da471 zh: d7ded257d0fd5559 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/page-tabs: - en: de9bc95ad579fc4e - zh: 14e74af14e0ab298 + en: 1de4fe390871d0da + zh: 1723ae12ccbe3697 /deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation: en: 203168fc87e939bd zh: 72d0ccd2c54f3f44 diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md index 74047e1a76..908e004e80 100644 --- a/packages/client/ui-plugin-manager/README.md +++ b/packages/client/ui-plugin-manager/README.md @@ -108,7 +108,7 @@ A row's page exists only while a `plugins.row.config` entry names the row, so a ### Page tabs -Another plugin adds a tab after the page's own **Installed** tab by registering into the `plugins.tab` list slot; the entry's `label` names the tab and `order` places it. The tabs appear under the page header once one entry exists and are hidden on a bundle's, row's, or official plugin's page; the selected tab survives leaving **Plugins**, and a tab whose entry leaves falls back to **Installed**. The page renders the selected entry in place of its groups and hides its own refresh and add buttons there. The owner props carry `install({ spec, registry?, title, version })` and `openPackage(name)`. `install` is for a version the person already confirmed in the tab: the install dialog opens at its check screen, without the spec form, names the plugin with `title` and `version` above the spec, which it shows in smaller monospace text, keeps that name on the progress and result screens, with the installed version once done, asks `registry` first for that install only and never remembers it, and offers **Retry** after a refusal; a hidden installation reopens instead. `openPackage` switches to **Installed** and opens the bundle's page when that tab lists it, and that page's back button returns to the tab that called it; a bundle the page leaves out, such as a built-in profile bundle, leaves the Installed list open. A confirmed install offers no GitHub mirror recovery, since that recovery reopens the spec form, and its back button cancels a running install. [`ui-plugin-market`](../ui-plugin-market/README.md) contributes the **Discover** tab here. +Another plugin adds a tab after the page's own **Installed** tab by registering into the `plugins.tab` list slot; the entry's `label` names the tab and `order` places it. The tabs appear under the page header once one entry exists and are hidden on a bundle's, row's, or official plugin's page; the selected tab survives leaving **Plugins**, and a tab whose entry leaves falls back to **Installed**. The page renders the selected entry in place of its groups and hides its own refresh and add buttons there. The owner props carry `install({ spec, registry?, title, version })` and `openPackage(name)`. `install` is for a version the person already confirmed in the tab: the install dialog opens at its check screen, without the spec form, names the plugin with `title` and `version` above the spec, which it shows in smaller monospace text, keeps that name on the progress and result screens, with the installed version once done, asks `registry` first for that install only and never remembers it, and offers **Retry** after a refusal; a hidden installation reopens instead. `openPackage` switches to **Installed** and opens the bundle's page when that tab lists it, and that page's back button returns to the tab that opened it; a bundle the page leaves out, such as a built-in profile bundle, leaves the Installed list open. A confirmed install offers no GitHub mirror recovery, since that recovery reopens the spec form, and its back button cancels a running install. [`ui-plugin-market`](../ui-plugin-market/README.md) contributes the **Discover** tab here. ----- diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md index 1a0b9380f6..aa822c0ff3 100644 --- a/packages/client/ui-plugin-manager/README.zh.md +++ b/packages/client/ui-plugin-manager/README.zh.md @@ -108,7 +108,7 @@ ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({ ### 页面标签页 -其他插件向 `plugins.tab` 列表 slot 注册条目,即可在页面自带的**已安装**标签页之后添加一个标签页;条目的 `label` 为标签页命名,`order` 决定其位置。至少存在一个条目时,标签页显示在页头下方;在组合包、行或官方插件的页面上隐藏。离开**插件**后,所选标签页保持不变;所选标签页的条目被移除时,回到**已安装**。页面渲染所选条目以代替自身的分组,并在此时隐藏自身的刷新和添加按钮。owner props 提供 `install({ spec, registry?, title, version })` 和 `openPackage(name)`。`install` 用于用户已在标签页中确认的版本:安装对话框在检查界面打开,不显示 spec 表单,在以较小等宽字显示的 spec 上方用 `title` 和 `version` 标明插件,并在进度和结果界面保持该名称,完成后显示已安装的版本;只在这一次安装中首先使用 `registry`,且从不记住它;被拒绝后提供**重试**;如果有隐藏中的安装任务,则改为重新打开该任务。`openPackage` 切换到**已安装**,并在该标签页列出该组合包时打开其页面,该页面的返回按钮回到调用它的标签页;页面不列出的组合包(例如内置 profile 组合包)只打开「已安装」列表。已确认的安装不提供 GitHub 镜像恢复,因为该恢复会重新打开 spec 表单;其返回按钮用于取消正在进行的安装。[`ui-plugin-market`](../ui-plugin-market/README.zh.md) 在这里贡献**发现**标签页。 +其他插件向 `plugins.tab` 列表 slot 注册条目,即可在页面自带的**已安装**标签页之后添加一个标签页;条目的 `label` 为标签页命名,`order` 决定其位置。至少存在一个条目时,标签页显示在页头下方;在组合包、行或官方插件的页面上隐藏。离开**插件**后,所选标签页保持不变;所选标签页的条目被移除时,回到**已安装**。页面渲染所选条目以代替自身的分组,并在此时隐藏自身的刷新和添加按钮。owner props 提供 `install({ spec, registry?, title, version })` 和 `openPackage(name)`。`install` 用于用户已在标签页中确认的版本:安装对话框在检查界面打开,不显示 spec 表单,在以较小等宽字显示的 spec 上方用 `title` 和 `version` 标明插件,并在进度和结果界面保持该名称,完成后显示已安装的版本;只在这一次安装中首先使用 `registry`,且从不记住它;被拒绝后提供**重试**;如果有隐藏中的安装任务,则改为重新打开该任务。`openPackage` 切换到**已安装**,并在该标签页列出该组合包时打开其页面,该页面的返回按钮回到打开它的标签页;页面不列出的组合包(例如内置 profile 组合包)只打开「已安装」列表。已确认的安装不提供 GitHub 镜像恢复,因为该恢复会重新打开 spec 表单;其返回按钮用于取消正在进行的安装。[`ui-plugin-market`](../ui-plugin-market/README.zh.md) 在这里贡献**发现**标签页。 ----- diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx index 20c579890a..93fe32cd3c 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx @@ -1577,10 +1577,9 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { const showsMainList = showsCards && !showsMoreList const installedCards = onInstalled && showsCards const openPkgInMore = openPkg !== undefined && openPkg.official && detailFromMore - // A bundle page opened from a contributed tab returns to that tab instead of the Installed lists. const returnTab = view.kind === 'package' || view.kind === 'row' ? view.returnTab : undefined const backToMore = openPkgInMore && returnTab === undefined - const pkgOrigin = { ...openPkgInMore ? { from: 'more' as const } : {}, ...returnTab === undefined ? {} : { returnTab } } + const pkgOrigin = returnTab !== undefined ? { returnTab } : backToMore ? { from: 'more' as const } : {} // The Installed tab's panel, whatever it currently shows; the More list is not a tab panel. const installedPanel = tabs.length === 0 || showsMoreList ? {} diff --git a/packages/client/ui-plugin-manager/src/client/slot-contract.ts b/packages/client/ui-plugin-manager/src/client/slot-contract.ts index b7a2c3fea2..1450f2bb96 100644 --- a/packages/client/ui-plugin-manager/src/client/slot-contract.ts +++ b/packages/client/ui-plugin-manager/src/client/slot-contract.ts @@ -100,7 +100,7 @@ export interface PluginTabProps { */ readonly install: (target: PluginTabInstall) => void /** - * Switch to the Installed tab and open a bundle's page. + * Switch to the Installed tab and open a bundle's page, whose back button returns to the calling tab. * @param packageName - npm package name of the bundle. */ readonly openPackage: (packageName: string) => void diff --git a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx index cfccfca57d..5f2fe45725 100644 --- a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx +++ b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx @@ -277,7 +277,7 @@ describe('PluginManagerPage', () => { expect(screen.getByRole('tabpanel', { name: 'Discover' })).toBeTruthy() }) - it('keeps the Installed tab panel through loading and the More list out of the tabs', () => { + it('keeps the Installed tab panel through loading and the More list out of the tabs, and returns a More plugin opened from Discover to Discover', () => { const worktree = '@deepseek-ai/dsh-experimental-tool-worktree' const { navigation, set } = renderTab({ status: 'loading', packages: [] }, {}, { 'plugins.tab:discover': (_view, owner) => ( @@ -299,13 +299,15 @@ describe('PluginManagerPage', () => { // An official plugin of the More list opened from Discover returns to Discover, not to the More list. fireEvent.click(screen.getByRole('button', { name: en.backToList })) expect(navigation.getSnapshot()).toEqual({ tab: 'discover', view: { kind: 'list' } }) - act(() => { navigation.actions.setTab('installed'); navigation.actions.setView({ kind: 'package', name: worktree }) }) + fireEvent.click(screen.getByRole('tab', { name: en.installedTab })) + act(() => { navigation.actions.setView({ kind: 'more' }) }) + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', worktree) })) fireEvent.click(screen.getByRole('button', { name: en.backToPackage.replace('{name}', en.moreTitle) })) expect(screen.getByRole('heading', { name: en.moreTitle, level: 1 })).toBeTruthy() }) it('keeps the opening tab through a row page opened from a bundle page', () => { - const { navigation } = renderTab({ packages: [pkg({ rows: [row()] })] }, { rows: new Set(['dsh-better-sidebar#sidebar']) }, { + const { navigation, setTabs } = renderTab({ packages: [pkg({ rows: [row()] })] }, { rows: new Set(['dsh-better-sidebar#sidebar']) }, { 'plugins.tab:discover': (_view, owner) => ( ), @@ -319,6 +321,12 @@ describe('PluginManagerPage', () => { expect(navigation.getSnapshot().view).toEqual({ kind: 'package', name: 'dsh-better-sidebar', returnTab: 'discover' }) fireEvent.click(screen.getByRole('button', { name: en.backToList })) expect(navigation.getSnapshot()).toEqual({ tab: 'discover', view: { kind: 'list' } }) + // A calling tab that left the ledger while the page was open falls back to Installed. + fireEvent.click(screen.getByRole('button', { name: 'Discover open' })) + setTabs([]) + fireEvent.click(screen.getByRole('button', { name: en.backToList })) + expect(navigation.getSnapshot().tab).toBe('installed') + expect(document.querySelector('[data-plugin-group="bundles"]')).not.toBeNull() }) it('shows a confirmed version by name above its spec, as a check and a refusal with retry, without the spec form or another registry', () => { diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 267ba267d7..49a50fc2e7 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -2617,7 +2617,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ }, ], ownerProps: [ - '/** Owner props of a page tab another plugin contributes, such as Discover. */\nexport interface PluginTabProps {\n /**\n * Install an exact version the person already confirmed: the page\'s install dialog opens at its check and progress\n * screens, without the spec form, and names the plugin and version above the spec.\n * @param target - the spec, optional registry, and display text.\n */\n readonly install: (target: PluginTabInstall) => void\n /**\n * Switch to the Installed tab and open a bundle\'s page.\n * @param packageName - npm package name of the bundle.\n */\n readonly openPackage: (packageName: string) => void\n}', + '/** Owner props of a page tab another plugin contributes, such as Discover. */\nexport interface PluginTabProps {\n /**\n * Install an exact version the person already confirmed: the page\'s install dialog opens at its check and progress\n * screens, without the spec form, and names the plugin and version above the spec.\n * @param target - the spec, optional registry, and display text.\n */\n readonly install: (target: PluginTabInstall) => void\n /**\n * Switch to the Installed tab and open a bundle\'s page, whose back button returns to the calling tab.\n * @param packageName - npm package name of the bundle.\n */\n readonly openPackage: (packageName: string) => void\n}', ], ownerPropsReferences: [ 'PluginTabInstall', From b5f3d3afc727f5f98fc9b339d92a9bb32a118e8b Mon Sep 17 00:00:00 2001 From: Turtle Date: Tue, 20 Oct 2026 12:43:55 +0800 Subject: [PATCH 3/4] Credit review by @turtle1999 Co-authored-by: turtle1999 <301751225+turtle1999@users.noreply.github.com> From fc02fe96247a107fd8007a5dec9aa6aa8cd508f5 Mon Sep 17 00:00:00 2001 From: Turtle Date: Tue, 20 Oct 2026 13:26:42 +0800 Subject: [PATCH 4/4] Credit review by @imccyu Co-authored-by: imccyu <276526105+imccyu@users.noreply.github.com>