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: drop superseded Rapid Reader shelf loads and remount workspace context per app
Adam Eivy9bf329176fa2
diff --git a/client/src/pages/RapidReader.jsx b/client/src/pages/RapidReader.jsxindex c45bb46a97..24a864a7a1 100644--- a/client/src/pages/RapidReader.jsx+++ b/client/src/pages/RapidReader.jsx@@ -101,11 +101,21 @@ export default function RapidReaderPage() {// The URL owns which shelf entry is open, so the row click only navigates —// the effect below is the single place that loads the record's text.const openShelf = (id) => navigate(`/rapid-reader/${id}`);- const loadShelfEntry = useCallback(async (id) => {- const entry = await getRapidReaderLibraryEntry(id, { silent: true }).catch((error) => { setShelfError(error?.message || 'Could not open shelf entry'); return null; });- if (entry?.text) { setText(entry.text); setActive({ text: entry.text, initialWordIndex: 0, documentId: rapidReaderDocumentId(entry.text), wordCount: entry.wordCount }); }- }, []);- useEffect(() => { if (shelfId) loadShelfEntry(shelfId); }, [shelfId, loadShelfEntry]);+ // A book's text is large and its request slow, so the user can pick another+ // shelf entry (or leave the route) before this one resolves. The guard drops a+ // superseded response so it can't open the wrong book under the current URL.+ useEffect(() => {+ if (!shelfId) return undefined;+ let current = true;+ getRapidReaderLibraryEntry(shelfId, { silent: true })+ .catch((error) => { if (current) setShelfError(error?.message || 'Could not open shelf entry'); return null; })+ .then((entry) => {+ if (!current || !entry?.text) return;+ setText(entry.text);+ setActive({ text: entry.text, initialWordIndex: 0, documentId: rapidReaderDocumentId(entry.text), wordCount: entry.wordCount });+ });+ return () => { current = false; };+ }, [shelfId]);const addToShelf = (entry) => setShelf((previous) => [Object.fromEntries(Object.entries(entry).filter(([key]) => key !== 'text')), ...previous]);const [saveToShelf, savingShelf] = useAsyncAction(async () => {const entry = await createRapidReaderLibraryEntry({ title: saveTitle, text: documentText }, { silent: true }).catch((error) => { setShelfError(error?.message || 'Could not save to shelf'); return null; });diff --git a/client/src/pages/RapidReader.test.jsx b/client/src/pages/RapidReader.test.jsxindex e593cc85ab..004ce4cc54 100644--- a/client/src/pages/RapidReader.test.jsx+++ b/client/src/pages/RapidReader.test.jsx@@ -182,6 +182,24 @@ describe('RapidReader shelf', () => {expect(api.getRapidReaderLibraryEntry).toHaveBeenCalledWith('shelf-1', { silent: true });});+ it('drops a superseded entry response so the slow earlier load cannot replace the newer pick', async () => {+ const SECOND = { ...ENTRY, id: 'shelf-2', title: 'Second Article', wordCount: 3 };+ api.listRapidReaderLibrary.mockResolvedValue([ENTRY, SECOND]);+ let resolveFirst;+ api.getRapidReaderLibraryEntry.mockImplementation((id) => id === 'shelf-1'+ ? new Promise((resolve) => { resolveFirst = resolve; })+ : Promise.resolve({ ...SECOND, text: 'one two three' }));+ await renderPage('/rapid-reader/shelf-1');++ fireEvent.click(await screen.findByRole('button', { name: 'Open Second Article' }));+ expect(await screen.findByText(/1\/3 words/)).toBeInTheDocument();++ await act(async () => { resolveFirst({ ...ENTRY, text: 'alpha bravo charlie delta echo' }); });++ expect(screen.getByText(/1\/3 words/)).toBeInTheDocument();+ expect(screen.queryByText(/1\/5 words/)).not.toBeInTheDocument();+ });+it('puts the opened entry in the URL rather than local state', async () => {api.listRapidReaderLibrary.mockResolvedValue([ENTRY]);api.getRapidReaderLibraryEntry.mockResolvedValue({ ...ENTRY, text: 'alpha bravo charlie delta' });diff --git a/client/src/pages/WorkspaceContexts.jsx b/client/src/pages/WorkspaceContexts.jsxindex 7353f20ba0..8cb56b9916 100644--- a/client/src/pages/WorkspaceContexts.jsx+++ b/client/src/pages/WorkspaceContexts.jsx@@ -264,7 +264,7 @@ export default function WorkspaceContexts() {Save and restore each project's working context — the active git branch, theshell sessions rooted in its repo, and the tasks scoped to it.</p>- {appId ? <ContextDetail appId={appId} /> : <ContextList />}+ {appId ? <ContextDetail key={appId} appId={appId} /> : <ContextList />}</div>);}