Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: stop a late Brain collection page from resetting the open reader to loading (#10000)
Adam Eivycd6f30449fb3
diff --git a/client/src/components/brain/tabs/MemoryTab.jsx b/client/src/components/brain/tabs/MemoryTab.jsxindex e93cb36e1e..7a86d82e3f 100644--- a/client/src/components/brain/tabs/MemoryTab.jsx+++ b/client/src/components/brain/tabs/MemoryTab.jsx@@ -183,7 +183,10 @@ export default function MemoryTab({ onRefresh, fixedType = null }) {setDetailResult(null);fetchRecord();return () => { active = false; };- }, [recordId, selectedType, listedRecord, records]);+ // Deliberately not keyed on `records`: usePagedCollection hands out a new array on+ // every reset/page landing, and each one would reset a resolved detail back to loading+ // (dropping an open editor) even though the URL-selected record did not change.+ }, [recordId, selectedType, listedRecord]);const detailResolved = detailResult?.id === recordId && detailResult?.type === selectedType;const viewerRecord = recordId ? ((detailResolved ? detailResult.record : null) || listedRecord) : null;diff --git a/client/src/components/dashboard/builtins/OnThisDayWidget.navigation.test.jsx b/client/src/components/dashboard/builtins/OnThisDayWidget.navigation.test.jsxindex d20e6a3ced..03810911a7 100644--- a/client/src/components/dashboard/builtins/OnThisDayWidget.navigation.test.jsx+++ b/client/src/components/dashboard/builtins/OnThisDayWidget.navigation.test.jsx@@ -155,6 +155,25 @@ describe('On This Day record destinations', () => {expect(screen.getByTestId('location').textContent).toBe(path);});+ it.each([+ ['memory', '/brain/memory/memories/example-second', 'getBrainMemories', 'getBrainMemory'],+ ['idea', '/brain/ideas/ideas/example-second', 'getBrainIdeas', 'getBrainIdea'],+ ])('keeps the open %s editor when the collection page lands after the reader loaded', async (type, path, listGetter, getter) => {+ let resolvePage;+ // Any refetch after the first load hangs, so a reset to "Loading entry" stays observable.+ api[getter].mockReset().mockResolvedValueOnce(second).mockImplementation(() => new Promise(() => {}));+ api[listGetter].mockImplementation(() => new Promise(resolve => { resolvePage = resolve; }));+ mount(type, path);+ const reader = await screen.findByRole('complementary', { name: 'Preview: Example second' });+ fireEvent.click(within(reader).getByRole('button', { name: 'Edit' }));+ expect(screen.getByRole('textbox', { name: 'Title' })).toBeTruthy();++ // The late list page must not reset the already-resolved detail back to loading.+ await act(async () => resolvePage({ items: [first], total: 2, nextCursor: 'older-page' }));+ expect(screen.queryByRole('complementary', { name: 'Loading entry' })).toBeNull();+ expect(screen.getByRole('textbox', { name: 'Title' })).toBeTruthy();+ });+it('drops a superseded detail response when another URL selects a different record', async () => {let resolveDetail;api.getBrainMemory.mockImplementation(() => new Promise(resolve => { resolveDetail = resolve; }));