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
address review: always emit sync:completed, reactive account updates
Adam Eivy425b83d5e87e
diff --git a/client/src/components/messages/AccountsTab.jsx b/client/src/components/messages/AccountsTab.jsxindex d1f7563051..62dfd0e6a1 100644--- a/client/src/components/messages/AccountsTab.jsx+++ b/client/src/components/messages/AccountsTab.jsx@@ -6,7 +6,7 @@ import * as api from '../../services/api';const TYPE_ICONS = { gmail: Mail, outlook: Globe, teams: MessageSquare };const TYPE_LABELS = { gmail: 'Gmail (MCP)', outlook: 'Outlook (Playwright)', teams: 'Teams (Playwright)' };-export default function AccountsTab({ accounts, onRefresh }) {+export default function AccountsTab({ accounts, setAccounts, onRefresh }) {const [showForm, setShowForm] = useState(false);const [form, setForm] = useState({ name: '', type: 'gmail', email: '' });const [saving, setSaving] = useState(false);@@ -21,7 +21,7 @@ export default function AccountsTab({ accounts, onRefresh }) {setShowForm(false);setForm({ name: '', type: 'gmail', email: '' });toast.success('Account created');- onRefresh();+ setAccounts(prev => [...prev, result]);};const handleDelete = async (id) => {@@ -30,14 +30,14 @@ export default function AccountsTab({ accounts, onRefresh }) {setDeleting(null);if (!ok) return toast.error('Failed to delete account');toast.success('Account deleted');- onRefresh();+ setAccounts(prev => prev.filter(a => a.id !== id));};const handleToggle = async (account) => {const result = await api.updateMessageAccount(account.id, { enabled: !account.enabled }).catch(() => null);if (!result) return toast.error('Failed to update account');toast.success(account.enabled ? 'Account disabled' : 'Account enabled');- onRefresh();+ setAccounts(prev => prev.map(a => a.id === account.id ? { ...a, enabled: !a.enabled } : a));};return (diff --git a/client/src/pages/Messages.jsx b/client/src/pages/Messages.jsxindex f7c4cbb7c6..c38041b49d 100644--- a/client/src/pages/Messages.jsx+++ b/client/src/pages/Messages.jsx@@ -42,7 +42,7 @@ export default function Messages() {case 'inbox':return <InboxTab accounts={accounts} />;case 'accounts':- return <AccountsTab accounts={accounts} onRefresh={fetchAccounts} />;+ return <AccountsTab accounts={accounts} setAccounts={setAccounts} />;case 'drafts':return <DraftsTab accounts={accounts} />;case 'sync':diff --git a/server/services/messageSync.js b/server/services/messageSync.jsindex cc7a9a6342..c58c6c307f 100644--- a/server/services/messageSync.js+++ b/server/services/messageSync.js@@ -131,11 +131,10 @@ export async function syncAccount(accountId, io) {await saveCache(accountId, cache);await updateSyncStatus(accountId, providerStatus === 'success' ? 'success' : providerStatus);+ io?.emit('messages:sync:completed', { accountId, newMessages: uniqueNew.length, status: providerStatus });if (providerStatus === 'success') {- io?.emit('messages:sync:completed', { accountId, newMessages: uniqueNew.length, status: providerStatus });io?.emit('messages:changed', {});}- // Non-success statuses (auth-required, no-browser, etc.) are emitted by the provider itselfconsole.log(`📧 Sync complete for ${account.name}: ${uniqueNew.length} new, status=${providerStatus}`);return { newMessages: uniqueNew.length, total: cache.messages.length, status: providerStatus };