From 34f4cf0b19d54c12fe348b5bf997ee9f522b646d Mon Sep 17 00:00:00 2001 From: sim Date: Sun, 15 Nov 2026 00:36:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(tasks):=20=E5=BD=92=E6=A1=A3=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E6=B8=85=E7=90=86=E6=97=B6=E5=9C=A8=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=B8=8A=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task-index/DesktopTaskArchiveList.vue | 7 +- .../task-index/DesktopTaskArchiveManager.vue | 36 ++++++---- .../DesktopTaskArchiveManager.spec.ts | 65 ++++++++++++++++++- .../shared/ui/loading/DesktopRingSpinner.vue | 24 +++++++ 4 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue diff --git a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveList.vue b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveList.vue index db0f4434a..fb0993368 100644 --- a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveList.vue +++ b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveList.vue @@ -8,6 +8,7 @@ import { NButton, NDropdown, NEmpty, NPopover, NTooltip } from 'naive-ui' import { computed, h } from 'vue' import { useBuddyI18n } from '@/i18n/buddyI18n' import DesktopIcon from '@/shared/ui/icon/DesktopIcon.vue' +import DesktopRingSpinner from '@/shared/ui/loading/DesktopRingSpinner.vue' import DesktopSpaceIcon from '../space/DesktopSpaceIcon.vue' const props = defineProps<{ @@ -15,6 +16,7 @@ const props = defineProps<{ spaces: readonly LocalSpace[] results: readonly ArchiveDeleteResult[] disabled: boolean + spaceActionBusy: { spaceId: string | null } | null language: BuddyLocale }>() const emit = defineEmits<{ @@ -73,8 +75,9 @@ const groups = computed(() => { {{ t('desktop.archive.spaceActions', { space: group.name }) }} diff --git a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue index 94364db7b..25821e649 100644 --- a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue +++ b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue @@ -21,7 +21,8 @@ const { query, spaceId, items, results, cursor, busy, loading, error, load, snap errorMessage: cause => resolveLocalChatErrorMessage(cause, props.language), notDeletedMessage: () => t('desktop.archive.notCompleted'), }) -const confirmation = shallowRef<{ items: readonly ConversationArchiveItem[], space?: string } | null>(null) +const confirmation = shallowRef<{ items: readonly ConversationArchiveItem[], space?: { id: string | null, name: string } } | null>(null) +const spaceActionBusy = shallowRef<{ spaceId: string | null } | null>(null) const notice = shallowRef(null) const detachedFailures = computed(() => results.value.filter(result => result.status === 'failed' && !items.value.some(item => item.id === result.item.id))) const disabled = computed(() => busy.value || !props.actions.ready.value) @@ -31,18 +32,31 @@ function requestDelete(targets: readonly ConversationArchiveItem[]) { } async function requestSpaceDelete(spaceId: string | null, name: string) { notice.value = null - const targets = await snapshotSpace(spaceId) - if (targets?.length) - confirmation.value = { items: targets, space: name } - else if (targets) - notice.value = t('desktop.archive.emptySpace') + spaceActionBusy.value = { spaceId } + try { + const targets = await snapshotSpace(spaceId) + if (targets?.length) + confirmation.value = { items: targets, space: { id: spaceId, name } } + else if (targets) + notice.value = t('desktop.archive.emptySpace') + } + finally { + spaceActionBusy.value = null + } } async function confirmDelete() { - const batch = confirmation.value?.items + const pendingConfirmation = confirmation.value + const batch = pendingConfirmation?.items if (!batch || disabled.value) return confirmation.value = null - await deleteBatch(batch) + spaceActionBusy.value = pendingConfirmation.space ? { spaceId: pendingConfirmation.space.id } : null + try { + await deleteBatch(batch) + } + finally { + spaceActionBusy.value = null + } } @@ -51,7 +65,7 @@ async function confirmDelete() {
- +
{{ t('desktop.archive.unavailable') }} @@ -65,7 +79,7 @@ async function confirmDelete() {
{{ t('desktop.archive.loading') }}
- +
{{ t('desktop.archive.more') }} @@ -76,7 +90,7 @@ async function confirmDelete() {

- {{ t('desktop.archive.deleteSpaceConfirm', { space: confirmation.space, count: confirmation.items.length }) }} + {{ t('desktop.archive.deleteSpaceConfirm', { space: confirmation.space.name, count: confirmation.items.length }) }}

{{ t('desktop.archive.deleteConfirm', { count: confirmation?.items.length ?? 0 }) }}

    diff --git a/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts b/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts index 3ab5d5b56..48664f620 100644 --- a/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts +++ b/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts @@ -56,12 +56,22 @@ function button(label: string, root: ParentNode = document) { return match! } -async function openSpaceCleanup(name: string, root: ParentNode) { +function deferred() { + let resolve!: (value: T) => void + const promise = new Promise((resolvePromise) => { resolve = resolvePromise }) + return { promise, resolve } +} + +async function selectSpaceCleanup(name: string, root: ParentNode) { button(`空间操作:${name}`, root).click() await vi.waitFor(() => expect(document.querySelector('.n-dropdown-option')).not.toBeNull()) const option = [...document.querySelectorAll('.n-dropdown-option')].find(option => option.textContent?.includes('清理归档任务')) expect(option).toBeDefined() option!.querySelector('.n-dropdown-option-body')!.click() +} + +async function openSpaceCleanup(name: string, root: ParentNode) { + await selectSpaceCleanup(name, root) await vi.waitFor(() => expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')).not.toBeNull()) } @@ -116,6 +126,59 @@ it('keeps confirmed IDs and revisions fixed across refresh and reports each dele expect(f.root.querySelector('[data-delete-result="failed"]')?.textContent).toContain('历史任务 two') }) +it('shows snapshot progress only on its space action button, including the unbound space, and clears it before confirmation', async () => { + const unbound = item('unbound') + const bound = item('bound', { spaceId: 'space-a' }) + const f = await mount([unbound, bound], [space('space-a', '设计空间')]) + const snapshot = deferred<{ items: ConversationArchiveItem[], nextCursor: string | null }>() + f.list.mockImplementation(request => request.limit === 100 && request.spaceId === null + ? snapshot.promise + : Promise.resolve({ items: [unbound, bound], nextCursor: null })) + + const unboundGroup = f.root.querySelector('[data-archive-space=""]')! + const boundGroup = f.root.querySelector('[data-archive-space="space-a"]')! + const unboundActions = button('空间操作:未绑定空间', unboundGroup) + const boundActions = button('空间操作:设计空间', boundGroup) + await selectSpaceCleanup('未绑定空间', f.root) + await vi.waitFor(() => expect(f.list).toHaveBeenLastCalledWith({ kind: 'managed', spaceId: null, limit: 100 })) + + expect(unboundActions.getAttribute('aria-busy')).toBe('true') + expect(unboundActions.querySelector('.desktop-ring-spinner')).not.toBeNull() + expect(boundActions.getAttribute('aria-busy')).toBeNull() + expect(boundActions.querySelector('.desktop-ring-spinner')).toBeNull() + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + + snapshot.resolve({ items: [unbound], nextCursor: null }) + await vi.waitFor(() => expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')?.textContent).toContain('历史任务 unbound')) + const confirmation = document.querySelector('[data-testid="task-archive-delete-confirm"]')! + expect(unboundActions.getAttribute('aria-busy')).toBeNull() + expect(unboundActions.querySelector('.desktop-ring-spinner')).toBeNull() + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + + button('取消', confirmation).click() + expect(unboundActions.querySelector('.desktop-ring-spinner')).toBeNull() + expect(f.remove).not.toHaveBeenCalled() +}) + +it('shows confirmed space deletion progress on the same action button until the batch finishes', async () => { + const archived = item('archived', { spaceId: 'space-a' }) + const f = await mount([archived], [space('space-a', '设计空间')]) + await openSpaceCleanup('设计空间', f.root) + const actions = button('空间操作:设计空间', f.root.querySelector('[data-archive-space="space-a"]')!) + const deletion = deferred() + f.remove.mockReturnValueOnce(deletion.promise) + + button('删除', document.querySelector('[data-testid="task-archive-delete-confirm"]')!).click() + await vi.waitFor(() => expect(f.remove).toHaveBeenCalledWith('archived', 3)) + expect(actions.getAttribute('aria-busy')).toBe('true') + expect(actions.querySelector('.desktop-ring-spinner')).not.toBeNull() + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + + deletion.resolve(true) + await vi.waitFor(() => expect(actions.querySelector('.desktop-ring-spinner')).toBeNull()) + expect(actions.getAttribute('aria-busy')).toBeNull() +}) + it('previews every archive page in a space and only submits the confirmed immutable targets', async () => { const first = item('visible', { spaceId: 'space-a' }) const second = item('beyond-first-page', { spaceId: 'space-a', metadataRevision: 8 }) diff --git a/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue b/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue new file mode 100644 index 000000000..438c807d7 --- /dev/null +++ b/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue @@ -0,0 +1,24 @@ + + + From 9aa50be8babaad9818fefbbd3f0609f5ef75e7ad Mon Sep 17 00:00:00 2001 From: shanyuhai123 <864299347@qq.com> Date: Sun, 15 Nov 2026 10:33:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(tasks):=20=E4=BF=9D=E7=95=99=E5=BD=92?= =?UTF-8?q?=E6=A1=A3=E7=A9=BA=E9=97=B4=E6=B8=85=E7=90=86=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task-index/DesktopTaskArchiveManager.vue | 8 +- .../DesktopTaskArchiveManager.spec.ts | 140 +++++++++++++----- .../shared/ui/loading/DesktopRingSpinner.vue | 17 +-- 3 files changed, 114 insertions(+), 51 deletions(-) diff --git a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue index 25821e649..d111264a1 100644 --- a/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue +++ b/apps/buddy/src/modules/tasks/widgets/task-index/DesktopTaskArchiveManager.vue @@ -23,6 +23,12 @@ const { query, spaceId, items, results, cursor, busy, loading, error, load, snap }) const confirmation = shallowRef<{ items: readonly ConversationArchiveItem[], space?: { id: string | null, name: string } } | null>(null) const spaceActionBusy = shallowRef<{ spaceId: string | null } | null>(null) +const spaceActionProgressVisible = computed(() => { + const action = spaceActionBusy.value + return action !== null + && items.value.some(item => item.spaceId === action.spaceId) + && (action.spaceId === null || props.spaces.some(space => space.id === action.spaceId)) +}) const notice = shallowRef(null) const detachedFailures = computed(() => results.value.filter(result => result.status === 'failed' && !items.value.some(item => item.id === result.item.id))) const disabled = computed(() => busy.value || !props.actions.ready.value) @@ -65,7 +71,7 @@ async function confirmDelete() {
    - +
    {{ t('desktop.archive.unavailable') }} diff --git a/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts b/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts index 48664f620..799a5edd0 100644 --- a/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts +++ b/apps/buddy/src/modules/tasks/widgets/task-index/__tests__/DesktopTaskArchiveManager.spec.ts @@ -22,6 +22,7 @@ function space(id: string, name: string, revokedAt: string | null = null): Local } async function mount(items = [item()], spaces: readonly LocalSpace[] = []) { const ready = shallowRef(true) + const currentSpaces = shallowRef(spaces) const list = vi.fn().mockResolvedValue({ items, nextCursor: null }) const remove = vi.fn().mockResolvedValue(true) const restore = vi.fn().mockResolvedValue(true) @@ -43,12 +44,12 @@ async function mount(items = [item()], spaces: readonly LocalSpace[] = []) { } const root = document.createElement('div') document.body.append(root) - const app = createApp({ render: () => h(DesktopTaskArchiveManager, { actions, spaces, language: 'zh-CN', onView }) }) + const app = createApp({ render: () => h(DesktopTaskArchiveManager, { actions, spaces: currentSpaces.value, language: 'zh-CN', onView }) }) app.mount(root) cleanups.push(() => app.unmount()) await nextTick() await nextTick() - return { root, ready, list, remove, restore, onView, notify: () => listeners.forEach(listener => listener()) } + return { root, ready, spaces: currentSpaces, list, remove, restore, onView, notify: () => listeners.forEach(listener => listener()) } } function button(label: string, root: ParentNode = document) { const match = [...root.querySelectorAll('button')].find(button => (button.getAttribute('aria-label') || button.textContent?.trim()) === label) @@ -56,12 +57,6 @@ function button(label: string, root: ParentNode = document) { return match! } -function deferred() { - let resolve!: (value: T) => void - const promise = new Promise((resolvePromise) => { resolve = resolvePromise }) - return { promise, resolve } -} - async function selectSpaceCleanup(name: string, root: ParentNode) { button(`空间操作:${name}`, root).click() await vi.waitFor(() => expect(document.querySelector('.n-dropdown-option')).not.toBeNull()) @@ -126,57 +121,120 @@ it('keeps confirmed IDs and revisions fixed across refresh and reports each dele expect(f.root.querySelector('[data-delete-result="failed"]')?.textContent).toContain('历史任务 two') }) -it('shows snapshot progress only on its space action button, including the unbound space, and clears it before confirmation', async () => { - const unbound = item('unbound') - const bound = item('bound', { spaceId: 'space-a' }) - const f = await mount([unbound, bound], [space('space-a', '设计空间')]) - const snapshot = deferred<{ items: ConversationArchiveItem[], nextCursor: string | null }>() - f.list.mockImplementation(request => request.limit === 100 && request.spaceId === null - ? snapshot.promise - : Promise.resolve({ items: [unbound, bound], nextCursor: null })) - - const unboundGroup = f.root.querySelector('[data-archive-space=""]')! - const boundGroup = f.root.querySelector('[data-archive-space="space-a"]')! - const unboundActions = button('空间操作:未绑定空间', unboundGroup) - const boundActions = button('空间操作:设计空间', boundGroup) - await selectSpaceCleanup('未绑定空间', f.root) - await vi.waitFor(() => expect(f.list).toHaveBeenLastCalledWith({ kind: 'managed', spaceId: null, limit: 100 })) +it.each([ + { spaceId: null, name: '未绑定空间', otherName: '设计空间' }, + { spaceId: 'space-a', name: '设计空间', otherName: '未绑定空间' }, +])('shows snapshot progress only on $name and clears it before confirmation', async ({ spaceId, name, otherName }) => { + const target = item('target', { spaceId }) + const other = item('other', { spaceId: spaceId === null ? 'space-a' : null }) + const f = await mount([target, other], [space('space-a', '设计空间')]) + const snapshot = Promise.withResolvers<{ items: ConversationArchiveItem[], nextCursor: string | null }>() + f.list.mockReturnValueOnce(snapshot.promise) - expect(unboundActions.getAttribute('aria-busy')).toBe('true') - expect(unboundActions.querySelector('.desktop-ring-spinner')).not.toBeNull() - expect(boundActions.getAttribute('aria-busy')).toBeNull() - expect(boundActions.querySelector('.desktop-ring-spinner')).toBeNull() + const actions = button(`空间操作:${name}`, f.root) + const otherActions = button(`空间操作:${otherName}`, f.root) + await selectSpaceCleanup(name, f.root) + await vi.waitFor(() => expect(actions.getAttribute('aria-busy')).toBe('true')) + expect(f.list).toHaveBeenLastCalledWith({ kind: 'managed', spaceId, limit: 100 }) + expect(actions.querySelector('.desktop-ring-spinner')).not.toBeNull() + expect(otherActions.getAttribute('aria-busy')).toBeNull() + expect(otherActions.querySelector('.desktop-ring-spinner')).toBeNull() expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() - snapshot.resolve({ items: [unbound], nextCursor: null }) - await vi.waitFor(() => expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')?.textContent).toContain('历史任务 unbound')) + snapshot.resolve({ items: [target], nextCursor: null }) + await vi.waitFor(() => expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')?.textContent).toContain('历史任务 target')) const confirmation = document.querySelector('[data-testid="task-archive-delete-confirm"]')! - expect(unboundActions.getAttribute('aria-busy')).toBeNull() - expect(unboundActions.querySelector('.desktop-ring-spinner')).toBeNull() + expect(actions.getAttribute('aria-busy')).toBeNull() + expect(actions.querySelector('.desktop-ring-spinner')).toBeNull() expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() button('取消', confirmation).click() - expect(unboundActions.querySelector('.desktop-ring-spinner')).toBeNull() + await nextTick() + expect(f.root.querySelector('[data-testid="task-archive-manager"]')?.getAttribute('aria-busy')).toBe('false') + expect(actions.querySelector('.desktop-ring-spinner')).toBeNull() expect(f.remove).not.toHaveBeenCalled() }) -it('shows confirmed space deletion progress on the same action button until the batch finishes', async () => { - const archived = item('archived', { spaceId: 'space-a' }) - const f = await mount([archived], [space('space-a', '设计空间')]) +it('keeps space progress through every deletion and the final refresh, including partial failure', async () => { + const first = item('first', { spaceId: 'space-a' }) + const second = item('second', { spaceId: 'space-a', metadataRevision: 7 }) + const f = await mount([first, second], [space('space-a', '设计空间')]) await openSpaceCleanup('设计空间', f.root) - const actions = button('空间操作:设计空间', f.root.querySelector('[data-archive-space="space-a"]')!) - const deletion = deferred() - f.remove.mockReturnValueOnce(deletion.promise) + const actions = button('空间操作:设计空间', f.root) + const firstDeletion = Promise.withResolvers() + const secondDeletion = Promise.withResolvers() + const refresh = Promise.withResolvers<{ items: ConversationArchiveItem[], nextCursor: string | null }>() + f.remove.mockReturnValueOnce(firstDeletion.promise).mockReturnValueOnce(secondDeletion.promise) + f.list.mockReturnValueOnce(refresh.promise) button('删除', document.querySelector('[data-testid="task-archive-delete-confirm"]')!).click() - await vi.waitFor(() => expect(f.remove).toHaveBeenCalledWith('archived', 3)) + await vi.waitFor(() => expect(actions.getAttribute('aria-busy')).toBe('true')) + expect(f.remove.mock.calls).toEqual([['first', 3]]) + expect(actions.querySelector('.desktop-ring-spinner')).not.toBeNull() + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + + firstDeletion.resolve(true) + await vi.waitFor(() => expect(f.remove.mock.calls).toEqual([['first', 3], ['second', 7]])) + expect(actions.getAttribute('aria-busy')).toBe('true') + expect(actions.querySelector('.desktop-ring-spinner')).not.toBeNull() + + secondDeletion.resolve(false) + await vi.waitFor(() => expect(f.root.querySelector('[data-delete-result="failed"]')).not.toBeNull()) expect(actions.getAttribute('aria-busy')).toBe('true') expect(actions.querySelector('.desktop-ring-spinner')).not.toBeNull() expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + refresh.resolve({ items: [second], nextCursor: null }) + await vi.waitFor(() => expect(actions.getAttribute('aria-busy')).toBeNull()) + expect(actions.querySelector('.desktop-ring-spinner')).toBeNull() + expect(actions.disabled).toBe(false) + expect(f.root.querySelector('[data-archive-id="first"]')).toBeNull() + expect(f.root.querySelector('[data-archive-id="second"] [data-delete-result="failed"]')).not.toBeNull() +}) + +it.each(['group removed', 'list empty', 'space unavailable'])('falls back to toolbar progress when confirmation outlives its action button: %s', async (change) => { + const target = item('target', { spaceId: 'space-a' }) + const other = item('other') + const f = await mount([target, other], [space('space-a', '设计空间')]) + f.list.mockResolvedValueOnce({ items: [target], nextCursor: null }) + await openSpaceCleanup('设计空间', f.root) + + if (change === 'space unavailable') { + f.spaces.value = [] + await nextTick() + } + else { + f.list.mockResolvedValue({ items: change === 'list empty' ? [] : [other], nextCursor: null }) + f.notify() + await vi.waitFor(() => expect(f.root.querySelector('[data-archive-space="space-a"]')).toBeNull()) + } + expect(f.root.querySelector('[data-archive-space="space-a"] [data-testid="task-archive-space-actions"]')).toBeNull() + + const deletion = Promise.withResolvers() + f.remove.mockReturnValueOnce(deletion.promise) + button('删除', document.querySelector('[data-testid="task-archive-delete-confirm"]')!).click() + await vi.waitFor(() => expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).not.toBeNull()) + expect(f.root.querySelector('[data-testid="task-archive-manager"]')?.getAttribute('aria-busy')).toBe('true') + expect(f.root.querySelector('.desktop-ring-spinner')).toBeNull() + expect(f.remove.mock.calls).toEqual([['target', 3]]) + deletion.resolve(true) - await vi.waitFor(() => expect(actions.querySelector('.desktop-ring-spinner')).toBeNull()) - expect(actions.getAttribute('aria-busy')).toBeNull() + await vi.waitFor(() => expect(f.root.querySelector('[data-testid="task-archive-manager"]')?.getAttribute('aria-busy')).toBe('false')) + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() +}) + +it('clears snapshot progress after failure and allows retry', async () => { + const f = await mount() + f.list.mockRejectedValueOnce(new Error('snapshot failed')) + await selectSpaceCleanup('未绑定空间', f.root) + await vi.waitFor(() => expect(f.root.textContent).toContain('本地任务操作失败')) + expect(f.root.querySelector('.desktop-ring-spinner')).toBeNull() + expect(f.root.querySelector('[data-testid="task-archive-toolbar"] .n-spin')).toBeNull() + expect(button('空间操作:未绑定空间', f.root).disabled).toBe(false) + expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')).toBeNull() + + await openSpaceCleanup('未绑定空间', f.root) + expect(document.querySelector('[data-testid="task-archive-delete-confirm"]')?.textContent).toContain('历史任务 task') }) it('previews every archive page in a space and only submits the confirmed immutable targets', async () => { diff --git a/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue b/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue index 438c807d7..52fcf1ffa 100644 --- a/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue +++ b/apps/buddy/src/shared/ui/loading/DesktopRingSpinner.vue @@ -1,24 +1,23 @@ -