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: wait for saved Beeper scopes before adding another (#9985)

[._.]/ Adam Eivyc6491fc7f259
diff --git a/client/src/components/messages/BeeperTab.test.jsx b/client/src/components/messages/BeeperTab.test.jsx
index f687b8eb46..e8f8e4d81d 100644
--- a/client/src/components/messages/BeeperTab.test.jsx
+++ b/client/src/components/messages/BeeperTab.test.jsx
@@ -1715,6 +1715,7 @@ describe('saved conversation scopes', () => {
api.getBeeperScopes.mockRejectedValueOnce(new Error('Example read failure')).mockResolvedValue({ scopes: [saved] });
renderTab();
expect(await screen.findByText(/Could not load saved scopes/)).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Add scope' })).toBeDisabled();
fireEvent.click(screen.getByRole('button', { name: 'Retry scopes' }));
expect(await screen.findByRole('button', { name: saved.name })).toBeInTheDocument();
api.getBeeperScopes.mockResolvedValue({ scopes: [] });
@@ -1728,6 +1729,7 @@ describe('saved conversation scopes', () => {
api.createBeeperScope.mockRejectedValueOnce(new Error('Example save failure')).mockResolvedValueOnce(saved);
renderTab('/messages/beeper?scope=net:signal&q=Example&unread=1');
await screen.findByRole('button', { name: 'Add scope' });
+ await awaitEnabled(screen.getByRole('button', { name: 'Add scope' }));
fireEvent.click(screen.getByRole('button', { name: 'Add scope' }));
fireEvent.change(screen.getByLabelText('Scope name'), { target: { value: saved.name } });
fireEvent.click(screen.getByRole('button', { name: 'Save scope' }));
diff --git a/client/src/components/messages/beeper/BeeperChatSurface.jsx b/client/src/components/messages/beeper/BeeperChatSurface.jsx
index 8ac4b1c5a9..dd78be1e10 100644
--- a/client/src/components/messages/beeper/BeeperChatSurface.jsx
+++ b/client/src/components/messages/beeper/BeeperChatSurface.jsx
@@ -174,7 +174,7 @@ function SyncStrip({ sweep }) {
/* ------------------------------------------------------------------ rail -- */
function Rail({
- networks, scope, onScope, totalUnread, onOpenSettings, savedScopes, onAddScope,
+ networks, scope, onScope, totalUnread, onOpenSettings, savedScopes, onAddScope, scopesReady,
}) {
const item = 'relative flex size-11 shrink-0 items-center justify-center rounded-xl transition';
return (
@@ -209,7 +209,7 @@ function Rail({
<Bookmark size={19} />
</button>
))}
- <button type="button" title="Save current scope" aria-label="Add scope" onClick={onAddScope}
+ <button type="button" title="Save current scope" aria-label="Add scope" disabled={!scopesReady} onClick={onAddScope}
className={`${item} text-gray-500 hover:text-white`}><Plus size={19} /></button>
<div className="mx-1 h-7 w-px shrink-0 bg-port-border sm:mx-0 sm:my-1.5 sm:h-px sm:w-7" />
@@ -903,6 +903,7 @@ export default function BeeperChatSurface({
return params;
}, { replace: true })}
savedScopes={savedScopes || []}
+ scopesReady={savedScopes !== null}
onAddScope={() => { setScopeEditor({ filters }); setScopeName(''); }}
totalUnread={totalUnread}
onOpenSettings={onOpenSettings}