From dbfd15e0a3271bb8f2bbc97f1acdd6a76c46b2de Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 18:36:27 +0000 Subject: [PATCH 1/4] fix(app-shell): drop a deleted record from the recently-accessed list Claude-Session: https://claude.ai/code/session_01ADHkmTS7jKcrSq1mgNofuy Co-authored-by: Claude --- .../app-shell/src/console/ConsoleShell.tsx | 14 ++- .../src/context/RecentItemsProvider.tsx | 67 ++++++++++- .../__tests__/RecentItemsProvider.test.tsx | 112 ++++++++++++++++++ 3 files changed, 190 insertions(+), 3 deletions(-) diff --git a/ui/packages/app-shell/src/console/ConsoleShell.tsx b/ui/packages/app-shell/src/console/ConsoleShell.tsx index 6f465c36279..69732c58463 100644 --- a/ui/packages/app-shell/src/console/ConsoleShell.tsx +++ b/ui/packages/app-shell/src/console/ConsoleShell.tsx @@ -36,7 +36,7 @@ import { AiUnavailable } from './ai/AiUnavailable.js'; import { PreviewModeProvider } from '../preview/PreviewModeContext.js'; import { NavigationProvider } from '../context/NavigationContext.js'; import { FavoritesProvider } from '../context/FavoritesProvider.js'; -import { RecentItemsProvider } from '../context/RecentItemsProvider.js'; +import { RecentItemsProvider, useDropDeletedRecordsFromRecents } from '../context/RecentItemsProvider.js'; import { FlowPaletteRecentsProvider } from '../context/FlowPaletteRecentsProvider.js'; import { UserStateAdaptersProvider, @@ -339,6 +339,7 @@ function ConnectedShellInner({ children }: { children: ReactNode }) { switch of language reads again. */} + {children} @@ -436,6 +437,17 @@ function UserStateBridge() { return null; } +/** + * DeletedRecordsLeaveRecents — a record this session deletes leaves the + * recently-accessed list at once, whichever page deleted it, so the command + * palette and Home never offer a record that is gone. The one subscriber, to + * the connected adapter's mutation events. Renders nothing. + */ +function DeletedRecordsLeaveRecents() { + useDropDeletedRecordsFromRecents(useAdapter()); + return null; +} + /** * RequireOrganization — redirects to /organizations when the multi-tenant * feature is enabled (user has orgs but no active one). Single-tenant diff --git a/ui/packages/app-shell/src/context/RecentItemsProvider.tsx b/ui/packages/app-shell/src/context/RecentItemsProvider.tsx index 88ee7c2ce22..0dee75f4895 100644 --- a/ui/packages/app-shell/src/context/RecentItemsProvider.tsx +++ b/ui/packages/app-shell/src/context/RecentItemsProvider.tsx @@ -38,6 +38,7 @@ import { type ReactNode, } from 'react'; import { useAuth } from '@object-ui/auth'; +import type { DataSource } from '@object-ui/types'; import { createDebouncedFlush, scopedKey, @@ -133,6 +134,14 @@ interface RecentItemsContextValue { * An id the list does not hold changes nothing and writes nothing. */ removeRecentItem: (id: string) => void; + /** + * Drops the entry of record `recordId` of `objectName` — for a record this + * tab KNOWS is gone, such as one it just deleted. The object name is matched + * without regard to case, as the record page matches a delete event; the + * record id exactly. A record the list does not hold changes nothing and + * writes nothing. + */ + removeRecordItem: (objectName: string, recordId: string) => void; clearRecentItems: () => void; } @@ -217,6 +226,22 @@ function contentOf(item: RecentItem): string { } } +/** + * Whether `item` is the entry of record `recordId` of `objectName`. A record + * entry's id is `record:OBJECT:RECORD_ID`, the one the record page writes; an + * object's machine name holds no colon, so the first colon after the object + * ends it. + */ +function isRecordEntryOf(item: RecentItem, objectName: string, recordId: string): boolean { + if (item.type !== 'record') return false; + const prefix = 'record:'; + if (!item.id.startsWith(prefix)) return false; + const rest = item.id.slice(prefix.length); + const colon = rest.indexOf(':'); + if (colon < 0) return false; + return rest.slice(0, colon).toLowerCase() === objectName.toLowerCase() && rest.slice(colon + 1) === recordId; +} + function loadRecent(userId?: string | null): RecentItem[] { try { const raw = localStorage.getItem(scopedKey(STORAGE_BASE_KEY, userId)); @@ -341,13 +366,23 @@ export function RecentItemsProvider({ children }: { children: ReactNode }) { [commit], ); + const removeRecordItem = useCallback( + (objectName: string, recordId: string) => { + const prev = itemsRef.current; + const next = prev.filter(r => !isRecordEntryOf(r, objectName, recordId)); + if (next.length === prev.length) return; + commit(next); + }, + [commit], + ); + const clearRecentItems = useCallback(() => { commit([]); }, [commit]); const value = useMemo( - () => ({ recentItems, addRecentItem, removeRecentItem, clearRecentItems }), - [recentItems, addRecentItem, removeRecentItem, clearRecentItems], + () => ({ recentItems, addRecentItem, removeRecentItem, removeRecordItem, clearRecentItems }), + [recentItems, addRecentItem, removeRecentItem, removeRecordItem, clearRecentItems], ); return ( @@ -375,8 +410,36 @@ export function useRecentItems(): RecentItemsContextValue { recentItems: [], addRecentItem: () => {}, removeRecentItem: () => {}, + removeRecordItem: () => {}, clearRecentItems: () => {}, }; } return ctx; } + +/** The part of a data source this module reads: its mutation events. */ +type MutationSource = Pick; + +/** + * Drops a record from the recents the moment `dataSource` reports it deleted, + * so neither the command palette nor Home's "recently accessed" offers a + * record that is gone. One subscription, to the data source's mutation bus, + * covers every delete door that reports its record — the record page's + * header, a list row, an action — with no call at each of them. + * + * Undoing the delete restores the record; the visit that follows records it + * again, the way any visit does. A delete event that names no record (a bulk + * delete reports only its object) drops nothing: nothing in it says which. + * + * Mount it once, under the data source and inside a {@link RecentItemsProvider}. + */ +export function useDropDeletedRecordsFromRecents(dataSource: MutationSource | null | undefined): void { + const { removeRecordItem } = useRecentItems(); + useEffect(() => { + if (typeof dataSource?.onMutation !== 'function') return; + return dataSource.onMutation(event => { + if (event.type !== 'delete' || event.id == null || !event.resource) return; + removeRecordItem(event.resource, event.id); + }); + }, [dataSource, removeRecordItem]); +} diff --git a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx index 234b0bd450f..ff36b661dfa 100644 --- a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx +++ b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx @@ -18,9 +18,11 @@ vi.mock('@object-ui/auth', async (importOriginal) => ({ import { RecentItemsProvider, + useDropDeletedRecordsFromRecents, useRecentItems, type RecentItem, } from '../RecentItemsProvider'; +import type { DataSourceMutationEvent } from '@object-ui/types'; import { recentViewId } from '../../hooks/useTrackRouteAsRecent'; import { UserStateAdaptersProvider, @@ -485,3 +487,113 @@ describe('RecentItemsProvider — one entry per target (objectui#12604)', () => expect(result.current.recentItems.map((r) => r.id)).toEqual(['view:z']); }); }); + +/** + * objectstack#33826 — a deleted record leaves the recents. The data source's + * mutation bus reports the delete; one subscriber drops the record's entry, so + * neither the command palette nor Home offers a record that is gone. + */ +describe('RecentItemsProvider — a deleted record leaves the recents (objectstack#33826)', () => { + const KEY = 'objectui-recent-items:u:user-1'; + + beforeEach(() => { + localStorage.clear(); + mockUser.current = { id: 'user-1', name: 'Alice', email: 'a@x' }; + }); + + /** A data source that only reports mutations, and the means to report one. */ + function makeMutationSource() { + const listeners = new Set<(e: DataSourceMutationEvent) => void>(); + return { + onMutation: (cb: (e: DataSourceMutationEvent) => void) => { + listeners.add(cb); + return () => { + listeners.delete(cb); + }; + }, + emit: (e: DataSourceMutationEvent) => listeners.forEach((cb) => cb(e)), + }; + } + + const record = (object: string, id: string, label: string) => + ({ id: `record:${object}:${id}`, type: 'record', label, href: `/apps/crm/${object}/record/${id}` }) as const; + + async function mount() { + const source = makeMutationSource(); + const adapter = makeAdapter([]); + const view = renderHook( + () => { + useDropDeletedRecordsFromRecents(source); + return useHarness(); + }, + { wrapper }, + ); + act(() => view.result.current.attach('recent', adapter)); + await waitFor(() => expect(adapter.loadMock).toHaveBeenCalled()); + await act(async () => { + await Promise.resolve(); + }); + act(() => view.result.current.recent.addRecentItem({ id: 'object:crm_account', type: 'object', name: 'crm_account', href: '/apps/crm/crm_account' })); + act(() => view.result.current.recent.addRecentItem(record('crm_account', 'a1', 'Browser Test Co'))); + act(() => view.result.current.recent.addRecentItem(record('crm_account', 'b2', 'Globex'))); + adapter.saveMock.mockClear(); + return { ...view, source, adapter }; + } + + const ids = (items: RecentItem[]) => items.map((r) => r.id); + + it('the deleted record is gone from the list, localStorage and the saved row', async () => { + const { result, source, adapter } = await mount(); + act(() => source.emit({ type: 'delete', resource: 'crm_account', id: 'a1' })); + + expect(ids(result.current.recent.recentItems)).toEqual(['record:crm_account:b2', 'object:crm_account']); + expect(ids(JSON.parse(localStorage.getItem(KEY)!))).toEqual(['record:crm_account:b2', 'object:crm_account']); + await waitFor(() => expect(adapter.saveMock).toHaveBeenCalledTimes(1), { timeout: 1500 }); + expect(ids(adapter.saveMock.mock.calls[0][0])).toEqual(['record:crm_account:b2', 'object:crm_account']); + }); + + it('control: deleting another record leaves this one listed, and writes nothing', async () => { + const { result, source, adapter } = await mount(); + const before = ids(result.current.recent.recentItems); + act(() => source.emit({ type: 'delete', resource: 'crm_account', id: 'zz9' })); + act(() => source.emit({ type: 'delete', resource: 'crm_contact', id: 'a1' })); + + expect(ids(result.current.recent.recentItems)).toEqual(before); + await new Promise((r) => setTimeout(r, 700)); + expect(adapter.saveMock).not.toHaveBeenCalled(); + }); + + it('control: an update of the record, or a delete that names no record (a bulk delete), drops nothing', async () => { + const { result, source } = await mount(); + const before = ids(result.current.recent.recentItems); + act(() => source.emit({ type: 'update', resource: 'crm_account', id: 'a1' })); + act(() => source.emit({ type: 'delete', resource: 'crm_account' })); + + expect(ids(result.current.recent.recentItems)).toEqual(before); + }); + + it('the object name is matched as the record page matches it, without regard to case', async () => { + const { result, source } = await mount(); + act(() => source.emit({ type: 'delete', resource: 'CRM_Account', id: 'a1' })); + + expect(ids(result.current.recent.recentItems)).not.toContain('record:crm_account:a1'); + }); + + it('after an undo, the visit to the restored record lists it again', async () => { + const { result, source } = await mount(); + act(() => source.emit({ type: 'delete', resource: 'crm_account', id: 'a1' })); + expect(ids(result.current.recent.recentItems)).not.toContain('record:crm_account:a1'); + + // The record page's Undo restores the record and returns to it; that visit records it. + act(() => result.current.recent.addRecentItem(record('crm_account', 'a1', 'Browser Test Co'))); + expect(ids(result.current.recent.recentItems)[0]).toBe('record:crm_account:a1'); + }); + + it('unsubscribes when unmounted', async () => { + const { result, source, unmount } = await mount(); + const before = ids(result.current.recent.recentItems); + unmount(); + act(() => source.emit({ type: 'delete', resource: 'crm_account', id: 'a1' })); + expect(ids(JSON.parse(localStorage.getItem(KEY)!))).toEqual(before); + }); +}); From e31202760e887260002a3191dbcf68f435627f7a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 18:43:55 +0000 Subject: [PATCH 2/4] test(app-shell): pin the shell's one delete subscriber for the recents Claude-Session: https://claude.ai/code/session_01ADHkmTS7jKcrSq1mgNofuy Co-authored-by: Claude --- ....deletedRecordLeavesRecents-33826.test.tsx | 130 ++++++++++++++++++ .../__tests__/RecentItemsProvider.test.tsx | 2 + 2 files changed, 132 insertions(+) create mode 100644 ui/packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx diff --git a/ui/packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx b/ui/packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx new file mode 100644 index 00000000000..e624157d180 --- /dev/null +++ b/ui/packages/app-shell/src/console/__tests__/ConnectedShell.deletedRecordLeavesRecents-33826.test.tsx @@ -0,0 +1,130 @@ +/** + * objectstack#33826 — a record deleted in the console leaves the + * recently-accessed list that the command palette and Home read. + * + * The one subscriber that drops it, `useDropDeletedRecordsFromRecents`, is + * mounted once, in `ConnectedShellInner`, on the connected adapter's mutation + * events. This pins that mount: the console's provider stack holds the + * recents above the shell (`ConsoleShell` wraps every `ConnectedShell`), the + * adapter reports a delete the way `ObjectStackAdapter.delete` does, and the + * probe stands where the palette and Home read the list. + * + * What is real: `ConnectedShell` and everything it mounts, the recents + * provider and its storage. The adapter is a fake that serves the shell's + * metadata reads and reports mutations; the session is resolved, signed out, + * so no preference row is attached. + */ + +import '@testing-library/jest-dom/vitest'; +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { act, cleanup, render, screen } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; +import type { DataSourceMutationEvent } from '@object-ui/types'; + +const listeners = vi.hoisted(() => new Set<(e: { type: string; resource: string; id?: string }) => void>()); + +const fakeAdapter = vi.hoisted(() => ({ + clearCache: () => {}, + getObjectSchema: async () => null, + getClient: () => ({ + meta: { + getItems: (type: string) => Promise.resolve({ type, items: [] }), + getItem: () => Promise.resolve({ item: null }), + }, + }), + onMutation: (cb: (e: { type: string; resource: string; id?: string }) => void) => { + listeners.add(cb); + return () => { + listeners.delete(cb); + }; + }, +})); + +vi.mock('@object-ui/auth', async (importOriginal) => ({ + ...(await importOriginal>()), + useAuth: () => ({ + user: null, + session: null, + isAuthenticated: false, + isLoading: false, + isAuthEnabled: true, + error: null, + }), + createAuthenticatedFetch: () => globalThis.fetch, +})); + +// The adapter is not under test: the shell hands the fake to every +// `useAdapter()` reader. +vi.mock('../../providers/AdapterProvider', () => ({ + AdapterProvider: ({ children }: { children: React.ReactNode }) => <>{children}, + useAdapter: () => fakeAdapter, +})); + +import { ConnectedShell } from '../ConsoleShell'; +import { RecentItemsProvider, useRecentItems, type RecentItem } from '../../context/RecentItemsProvider'; +import { UserStateAdaptersProvider } from '../../context/UserStateAdapters'; + +const KEY = 'objectui-recent-items'; + +/** Stands where the palette and Home read the list. */ +function RecentsProbe() { + const { recentItems } = useRecentItems(); + return
    {recentItems.map((r) =>
  • {r.id}
  • )}
; +} + +function emit(e: DataSourceMutationEvent) { + listeners.forEach((cb) => cb(e as never)); +} + +const seeded: RecentItem[] = [ + { id: 'record:crm_account:a1', type: 'record', label: 'Browser Test Co', href: '/apps/crm/crm_account/record/a1', visitedAt: '2026-11-15T00:00:02Z' }, + { id: 'record:crm_account:b2', type: 'record', label: 'Globex', href: '/apps/crm/crm_account/record/b2', visitedAt: '2026-11-15T00:00:01Z' }, +]; + +function renderConsole() { + return render( + + + + + + + + + , + ); +} + +function listed(): string[] { + return Array.from(screen.getByTestId('recents').querySelectorAll('li')).map((li) => li.textContent ?? ''); +} + +describe('ConnectedShell — a deleted record leaves the recents (objectstack#33826)', () => { + beforeEach(() => { + localStorage.clear(); + localStorage.setItem(KEY, JSON.stringify(seeded)); + }); + afterEach(() => { + cleanup(); + listeners.clear(); + }); + + it('the delete the adapter reports drops that record, and only that one', async () => { + renderConsole(); + await screen.findByTestId('recents'); + expect(listed()).toEqual(['record:crm_account:a1', 'record:crm_account:b2']); + + act(() => emit({ type: 'delete', resource: 'crm_account', id: 'a1' })); + + expect(listed()).toEqual(['record:crm_account:b2']); + expect(JSON.parse(localStorage.getItem(KEY)!).map((r: RecentItem) => r.id)).toEqual(['record:crm_account:b2']); + }); + + it('control: with the shell unmounted, nothing listens', async () => { + const view = renderConsole(); + await screen.findByTestId('recents'); + expect(listeners.size).toBeGreaterThan(0); + view.unmount(); + expect(listeners.size).toBe(0); + }); +}); diff --git a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx index ff36b661dfa..63a6fab2c8f 100644 --- a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx +++ b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx @@ -536,6 +536,8 @@ describe('RecentItemsProvider — a deleted record leaves the recents (objectsta act(() => view.result.current.recent.addRecentItem({ id: 'object:crm_account', type: 'object', name: 'crm_account', href: '/apps/crm/crm_account' })); act(() => view.result.current.recent.addRecentItem(record('crm_account', 'a1', 'Browser Test Co'))); act(() => view.result.current.recent.addRecentItem(record('crm_account', 'b2', 'Globex'))); + // The visits' own debounced save lands first, so the counts below start at zero. + await waitFor(() => expect(adapter.saveMock).toHaveBeenCalled(), { timeout: 1500 }); adapter.saveMock.mockClear(); return { ...view, source, adapter }; } From e0607115cb54722c6dc55a320252689889c5f350 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 18:45:22 +0000 Subject: [PATCH 3/4] refactor(app-shell): drop deleted records through the provider's existing removeRecentItem Claude-Session: https://claude.ai/code/session_01ADHkmTS7jKcrSq1mgNofuy Co-authored-by: Claude --- .../src/context/RecentItemsProvider.tsx | 53 +++++-------------- .../__tests__/RecentItemsProvider.test.tsx | 7 --- 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/ui/packages/app-shell/src/context/RecentItemsProvider.tsx b/ui/packages/app-shell/src/context/RecentItemsProvider.tsx index 0dee75f4895..7e17c805436 100644 --- a/ui/packages/app-shell/src/context/RecentItemsProvider.tsx +++ b/ui/packages/app-shell/src/context/RecentItemsProvider.tsx @@ -134,14 +134,6 @@ interface RecentItemsContextValue { * An id the list does not hold changes nothing and writes nothing. */ removeRecentItem: (id: string) => void; - /** - * Drops the entry of record `recordId` of `objectName` — for a record this - * tab KNOWS is gone, such as one it just deleted. The object name is matched - * without regard to case, as the record page matches a delete event; the - * record id exactly. A record the list does not hold changes nothing and - * writes nothing. - */ - removeRecordItem: (objectName: string, recordId: string) => void; clearRecentItems: () => void; } @@ -226,22 +218,6 @@ function contentOf(item: RecentItem): string { } } -/** - * Whether `item` is the entry of record `recordId` of `objectName`. A record - * entry's id is `record:OBJECT:RECORD_ID`, the one the record page writes; an - * object's machine name holds no colon, so the first colon after the object - * ends it. - */ -function isRecordEntryOf(item: RecentItem, objectName: string, recordId: string): boolean { - if (item.type !== 'record') return false; - const prefix = 'record:'; - if (!item.id.startsWith(prefix)) return false; - const rest = item.id.slice(prefix.length); - const colon = rest.indexOf(':'); - if (colon < 0) return false; - return rest.slice(0, colon).toLowerCase() === objectName.toLowerCase() && rest.slice(colon + 1) === recordId; -} - function loadRecent(userId?: string | null): RecentItem[] { try { const raw = localStorage.getItem(scopedKey(STORAGE_BASE_KEY, userId)); @@ -366,23 +342,13 @@ export function RecentItemsProvider({ children }: { children: ReactNode }) { [commit], ); - const removeRecordItem = useCallback( - (objectName: string, recordId: string) => { - const prev = itemsRef.current; - const next = prev.filter(r => !isRecordEntryOf(r, objectName, recordId)); - if (next.length === prev.length) return; - commit(next); - }, - [commit], - ); - const clearRecentItems = useCallback(() => { commit([]); }, [commit]); const value = useMemo( - () => ({ recentItems, addRecentItem, removeRecentItem, removeRecordItem, clearRecentItems }), - [recentItems, addRecentItem, removeRecentItem, removeRecordItem, clearRecentItems], + () => ({ recentItems, addRecentItem, removeRecentItem, clearRecentItems }), + [recentItems, addRecentItem, removeRecentItem, clearRecentItems], ); return ( @@ -410,13 +376,20 @@ export function useRecentItems(): RecentItemsContextValue { recentItems: [], addRecentItem: () => {}, removeRecentItem: () => {}, - removeRecordItem: () => {}, clearRecentItems: () => {}, }; } return ctx; } +/** + * The id a record's recent entry is kept under — the one the record page + * writes: `record:OBJECT:RECORD_ID`, by the object's machine name. + */ +function recordRecentItemId(objectName: string, recordId: string): string { + return `record:${objectName}:${recordId}`; +} + /** The part of a data source this module reads: its mutation events. */ type MutationSource = Pick; @@ -434,12 +407,12 @@ type MutationSource = Pick; * Mount it once, under the data source and inside a {@link RecentItemsProvider}. */ export function useDropDeletedRecordsFromRecents(dataSource: MutationSource | null | undefined): void { - const { removeRecordItem } = useRecentItems(); + const { removeRecentItem } = useRecentItems(); useEffect(() => { if (typeof dataSource?.onMutation !== 'function') return; return dataSource.onMutation(event => { if (event.type !== 'delete' || event.id == null || !event.resource) return; - removeRecordItem(event.resource, event.id); + removeRecentItem(recordRecentItemId(event.resource, event.id)); }); - }, [dataSource, removeRecordItem]); + }, [dataSource, removeRecentItem]); } diff --git a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx index 63a6fab2c8f..7ab25f64189 100644 --- a/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx +++ b/ui/packages/app-shell/src/context/__tests__/RecentItemsProvider.test.tsx @@ -574,13 +574,6 @@ describe('RecentItemsProvider — a deleted record leaves the recents (objectsta expect(ids(result.current.recent.recentItems)).toEqual(before); }); - it('the object name is matched as the record page matches it, without regard to case', async () => { - const { result, source } = await mount(); - act(() => source.emit({ type: 'delete', resource: 'CRM_Account', id: 'a1' })); - - expect(ids(result.current.recent.recentItems)).not.toContain('record:crm_account:a1'); - }); - it('after an undo, the visit to the restored record lists it again', async () => { const { result, source } = await mount(); act(() => source.emit({ type: 'delete', resource: 'crm_account', id: 'a1' })); From a6cbed12127c78c127e43bc25ed1236d90b4b421 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 18:45:44 +0000 Subject: [PATCH 4/4] chore: changeset for the deleted record leaving the recents Claude-Session: https://claude.ai/code/session_01ADHkmTS7jKcrSq1mgNofuy Co-authored-by: Claude --- .changeset/33826-deleted-record-leaves-recents.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/33826-deleted-record-leaves-recents.md diff --git a/.changeset/33826-deleted-record-leaves-recents.md b/.changeset/33826-deleted-record-leaves-recents.md new file mode 100644 index 00000000000..e61e2a2bb23 --- /dev/null +++ b/.changeset/33826-deleted-record-leaves-recents.md @@ -0,0 +1,10 @@ +--- +'@object-ui/app-shell': patch +--- + +fix(app-shell): a deleted record leaves the recently-accessed list that the command palette and Home show + +Clause-②: no +Metadata-protocol: none + +Deleting a record left its entry in the recents, so the ⌘K palette's "Recent" group and Home's "recently accessed" still offered it, and opening it landed on a record that no longer exists. The connected shell now listens to the data source's delete events once and drops the deleted record's entry from the list, from localStorage and from the saved `ui.recent` preference. One listener covers every delete that reports its record: the record page's header, a list row, an action. Undoing the delete brings the record back, and the visit that follows lists it again. A bulk delete reports only its object, not its records, so it drops nothing.