Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): keep a loaded listing when the next discovery page is refused
Alfredo Lopeza3ddf423c4ac
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsxindex d46cd5857..b8678fd45 100644--- a/desktop-app/ui/src/pages/FilesPage.tsx+++ b/desktop-app/ui/src/pages/FilesPage.tsx@@ -1145,8 +1145,19 @@ export function FilesPage({// Scoped to the root view on purpose: `accessibleError` only reaches// `visibleError` when there is no `current`, so the card replaces exactly the// banner it suppresses and never hides a folder-listing error behind it.+ //+ // Also scoped to an empty listing. The discovery query is infinite, and+ // TanStack populates `error` on a rejected `fetchNextPage` while `data` still+ // holds every page fetched so far. Without this guard a `Load more` that hit+ // the budget replaced an intact listing with a full-surface card — the rows+ // the user already had vanished to report that the NEXT page failed. With+ // rows on screen the failure stays in the banner `visibleError` renders, so+ // it is still surfaced, just not by destroying the page.const blockingDiscoveryFailure =- !current && ctrl.discoveryFailure && ctrl.discoveryFailure.kind !== 'unsupported'+ !current &&+ visibleResources.length === 0 &&+ ctrl.discoveryFailure &&+ ctrl.discoveryFailure.kind !== 'unsupported'? ctrl.discoveryFailure: null// `visibleLoading` starts with `authorityPending`, which a 429 leaves true on@@ -1332,7 +1343,12 @@ export function FilesPage({{accessibleNotice ? <StatusBanner tone="info" text={accessibleNotice} /> : null}{visibleError && !accessRevoked && !blockingDiscoveryFailure ? (- <StatusBanner tone="error" text={visibleError} />+ // Presented, not raw. The banner is the non-blocking half of the+ // same read-plane failure the card shows, so it must not be the one+ // surface left leaking `Error invoking remote method '…'` at the+ // user — which is what it did for every failure the card declines+ // to take over, a rate-limited `Load more` among them.+ <StatusBanner tone="error" text={describeGfsReadError(visibleError).message} />) : null}{accessRevoked ? (diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsxindex dd92a8faf..f9e173767 100644--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx@@ -3419,6 +3419,58 @@ describe('FilesPage', () => {expect(retryDiscovery).toHaveBeenCalledTimes(1)})+ it('keeps an already-loaded listing when the NEXT discovery page is rate limited', () => {+ // Discovery is an infinite query: TanStack populates `error` on a rejected+ // `fetchNextPage` while `data` still holds every page already fetched. The+ // card renders ahead of the grid, so without gating it on an empty listing+ // a `Load more` that hit the budget wiped out the rows the user already+ // had, to announce that a page they never saw had failed.+ const rawMessage =+ "Error invoking remote method 'gfs:listAccessible': Error: 429 Too Many Requests: " ++ 'Too Many Requests retryAfterSeconds=120'+ hookMock.useGfsBrowserController.mockReturnValue({+ ...baseController(),+ // The first page succeeded, so the authority gate is closed and its rows+ // are on screen; only the follow-up page was refused.+ authorityPending: false,+ accessibleResources: [+ {+ resourceId: 'folder-1',+ rid: 'folder-1',+ gfsUri: 'gfs://main/folder-1',+ drive: 'main',+ parentResourceId: null,+ name: 'Product',+ kind: 'directory',+ path: '/Product',+ version: 1,+ bytes: 0,+ sources: ['grant'],+ permissions: ['read'],+ coversDescendants: true,+ },+ ],+ hasMoreAccessible: true,+ accessibleError: rawMessage,+ discoveryFailure: {+ kind: 'rate-limited',+ message: rawMessage,+ retryAfterSeconds: 120,+ retryAvailableAt: Date.now() + 120_000,+ },+ })++ renderFilesPage()++ // Witness: the loaded row really is rendered, so the absence of the card+ // below is about a listing that survived and not about a page that never+ // drew anything.+ expect(screen.getByRole('button', { name: 'Product' })).toBeTruthy()+ expect(screen.queryByTestId('gfs-discovery-retry-seconds')).toBeNull()+ // The failure is still surfaced — as the banner, not by razing the page.+ expect(screen.getByText(/Too many file requests/)).toBeTruthy()+ })+it('leaves an unsupported discovery failure on the existing info notice, with no card', () => {hookMock.useGfsBrowserController.mockReturnValue({...baseController(),