Skip to content

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

fix: avoid success toast when loop action fails (#8621)

[._.]/ Adam Eivye97090fd650b
diff --git a/client/src/pages/Loops.jsx b/client/src/pages/Loops.jsx
index 39e986b581..488392d53b 100644
--- a/client/src/pages/Loops.jsx
+++ b/client/src/pages/Loops.jsx
@@ -365,7 +365,11 @@ export default function Loops() {
const handleAction = async (action, id) => {
const entry = ACTION_MAP[action];
if (!entry) return;
- await entry.fn(id).catch(() => {});
+ try {
+ await entry.fn(id);
+ } catch {
+ return;
+ }
toast.success(entry.msg);
};
diff --git a/client/src/pages/Loops.test.jsx b/client/src/pages/Loops.test.jsx
index 4fbd988b0d..864d79522b 100644
--- a/client/src/pages/Loops.test.jsx
+++ b/client/src/pages/Loops.test.jsx
@@ -16,9 +16,44 @@ vi.mock('../services/socket', () => ({
default: { connected: true, on: vi.fn(), off: vi.fn(), emit: vi.fn() },
}));
+vi.mock('../components/ui/Toast', () => ({
+ default: { success: vi.fn() },
+}));
+
import Loops from './Loops';
import socket from '../services/socket';
import * as api from '../services/api';
+import toast from '../components/ui/Toast';
+
+describe('Loops action feedback (#8621)', () => {
+ const runningLoop = {
+ id: 'loop-1', name: 'Example loop', isRunning: true, intervalMs: 60_000,
+ currentIteration: 0, lastRun: null,
+ };
+
+ it('does not report success when a rendered action request fails', async () => {
+ api.getLoops.mockResolvedValueOnce([runningLoop]);
+ api.stopLoop.mockRejectedValueOnce(new Error('Request failed'));
+ toast.success.mockClear();
+ render(<Loops />);
+
+ await userEvent.click(await screen.findByRole('button', { name: 'Stop' }));
+
+ await waitFor(() => expect(api.stopLoop).toHaveBeenCalledWith('loop-1'));
+ expect(toast.success).not.toHaveBeenCalled();
+ });
+
+ it('reports success after a rendered action request resolves', async () => {
+ api.getLoops.mockResolvedValueOnce([runningLoop]);
+ api.stopLoop.mockResolvedValueOnce({});
+ toast.success.mockClear();
+ render(<Loops />);
+
+ await userEvent.click(await screen.findByRole('button', { name: 'Stop' }));
+
+ await waitFor(() => expect(toast.success).toHaveBeenCalledWith('Loop stopped'));
+ });
+});
describe('Loops reconnect resubscribe (#8110)', () => {
// The server rebuilds an empty per-socket subscriber Set on every reconnect