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: let the user discard an unsaved Stacker News account draft (#3319)
[._.]/ Adam Eivy539339592382
diff --git a/client/src/pages/StackerNews.jsx b/client/src/pages/StackerNews.jsxindex 75b3e78a06..bcd167e0e9 100644--- a/client/src/pages/StackerNews.jsx+++ b/client/src/pages/StackerNews.jsx@@ -420,8 +420,11 @@ export default function StackerNews() {</div>{/* These three read server-side saved state, so an unsaved edit wouldsilently not apply — say why they are disabled instead of leaving- the user to guess (the checks are also disabled mid-save). */}- {accountFormDirty && <p className="mt-3 text-sm text-port-warning">Unsaved changes to {scope}. Save the account before running these checks.</p>}+ the user to guess (the checks are also disabled mid-save). Closing+ the drawer deliberately keeps the draft so a half-finished 19-field+ edit survives a detour, which means the only way back out of the+ disabled state has to be an explicit discard. */}+ {accountFormDirty && <div className="mt-3 flex flex-wrap items-center gap-2"><p className="text-sm text-port-warning">Unsaved changes to {scope}. Save the account before running these checks.</p><button type="button" className={secondaryButton} disabled={Boolean(busy)} onClick={() => { setEditAccount(savedAccount); setAccountFormError(''); }}>Discard changes</button></div>}</section>) : <div className="rounded border border-port-border bg-port-card p-4 text-sm text-gray-400">Choose an account to edit its independent rules, models, and monitoring schedule.</div>}</div>diff --git a/client/src/pages/StackerNews.test.jsx b/client/src/pages/StackerNews.test.jsxindex 19893ca9d0..7b75e35c0c 100644--- a/client/src/pages/StackerNews.test.jsx+++ b/client/src/pages/StackerNews.test.jsx@@ -210,6 +210,25 @@ describe('StackerNews', () => {await waitFor(() => expect(screen.getByRole('button', { name: 'Sync now' })).toBeEnabled());});+ it('discards an unsaved account draft left behind by closing the drawer', async () => {+ const user = userEvent.setup();+ renderPage('/stacker-news/a1/accounts?snAccount=edit&snAccountTab=monitoring');+ const interval = await screen.findByLabelText('Monitoring interval (minutes)', { selector: '#edit-account-interval' });+ await user.clear(interval);+ await user.type(interval, '20');+ // Closing keeps the draft (a 19-field edit should survive a detour), so the+ // dependent actions stay disabled until the draft is saved or discarded.+ await user.click(screen.getByRole('button', { name: 'Close' }));+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Sync now' })).toBeDisabled();+ await user.click(screen.getByRole('button', { name: 'Discard changes' }));+ expect(screen.queryByText(/Unsaved changes to @art_steward/)).not.toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Sync now' })).toBeEnabled();+ await user.click(screen.getByRole('button', { name: 'Edit account settings' }));+ await user.click(drawerTab('Monitoring & models'));+ expect(intervalField()).toHaveValue(15);+ });+it('can explicitly remove a stored API key', async () => {const user = userEvent.setup();api.updateStackerNewsAccount.mockResolvedValue({ ...accounts[0], apiKeyConfigured: false });