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 the toast for a SongBook import result the form has moved past (#3903)
[._.]/ Adam Eivybedad1850621
diff --git a/client/src/pages/SongBookImport.jsx b/client/src/pages/SongBookImport.jsxindex f15bc53af3..6e4f200804 100644--- a/client/src/pages/SongBookImport.jsx+++ b/client/src/pages/SongBookImport.jsx@@ -134,15 +134,16 @@ export default function SongBookImport() {// they've left — must not write itself over what's on screen now.const isCurrent = () => urlRef.current === submittedUrl && tabRef.current === 'url';const data = await importSongFromUrl(normalizedUrl, { silent: true }).catch((err) => {+ // The toast is gated too — a failure for a URL the user has already typed+ // past is not news about the form they're looking at.+ if (!isCurrent()) return null;const message = importErrorMessage(err);toast.error(message);- if (isCurrent()) {- // Drop any earlier draft: leaving the previous song previewed under a- // failed URL is exactly the stale-form confusion this guards against.- setFetched(null);- applyMetaDefaults({});- setFetchError(message);- }+ // Drop any earlier draft: leaving the previous song previewed under a+ // failed URL is exactly the stale-form confusion this guards against.+ setFetched(null);+ applyMetaDefaults({});+ setFetchError(message);return null;});const draft = data?.draft;diff --git a/client/src/pages/SongBookImport.test.jsx b/client/src/pages/SongBookImport.test.jsxindex 82c49232b8..5db634fff2 100644--- a/client/src/pages/SongBookImport.test.jsx+++ b/client/src/pages/SongBookImport.test.jsx@@ -13,6 +13,7 @@ vi.mock('../components/ui/Toast', () => ({ default: { error: vi.fn(), success: vconst clipboard = vi.hoisted(() => ({ readClipboard: vi.fn() }));vi.mock('../lib/clipboard.js', () => clipboard);+import toast from '../components/ui/Toast';import SongBookImport from './SongBookImport.jsx';const renderPage = (path = '/songbook/import') => render(@@ -27,6 +28,7 @@ describe('SongBookImport', () => {api.createSong.mockReset().mockResolvedValue({ id: 'new-song-1' });api.importSongFromUrl.mockReset();clipboard.readClipboard.mockReset();+ toast.error.mockReset();});it('paste button stores the RAW clipboard text — normalization runs exactly once', async () => {@@ -248,6 +250,8 @@ describe('SongBookImport', () => {rejectFetch(Object.assign(new Error('Bad gateway'), { code: 'SONG_IMPORT_FETCH_FAILED' }));await waitFor(() => expect(screen.getByRole('button', { name: 'Fetch' }).textContent).toContain('Fetch'));expect(screen.queryByRole('alert')).toBeNull();+ // Nor a toast — it isn't news about the URL now in the input.+ expect(toast.error).not.toHaveBeenCalled();});it('sends an in-range pasted capo through unchanged', async () => {