Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app): r8-m11 show denied folder status

Josué9d7ad3632680
diff --git a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
index 84ba98c3e..1df7a7861 100644
--- a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
+++ b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
@@ -36,6 +36,7 @@ import { desktopQueryKeys } from './queryKeys'
*/
const DRIVE = 'main'
+export const GFS_UNAVAILABLE_LOCATION_MESSAGE = 'This folder or file is no longer available.'
type GfsAccessState = 'active' | 'revoked'
@@ -593,7 +594,7 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {
// Keep accessible roots and other GFS scopes intact, and avoid the
// foreground navigation setter so a background denial cannot advance it.
setCrumbsState([])
- setOpenError('This folder or file is no longer available.')
+ setOpenError(GFS_UNAVAILABLE_LOCATION_MESSAGE)
}, [])
useEffect(() => {
const resourceId = pendingDeniedResourceIdRef.current
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 49a8952cd..8f7785559 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -35,6 +35,7 @@ import {
import { GFS_DRIVE_MAIN } from '@constants/gfsBrowser'
import { desktopQueryKeys } from '@hooks/domain/queryKeys'
import {
+ GFS_UNAVAILABLE_LOCATION_MESSAGE,
type GfsCrumb,
type GfsDiscoveryFailure,
useGfsBrowserController,
@@ -1334,6 +1335,7 @@ export function FilesPage({
(ctrl.authorityPending && !ctrl.discoveryFailure) ||
(currentIsFolder ? loading : !current ? loadingAccessible : false)
const visibleError = currentIsFolder ? error : !current ? accessibleError : null
+ const unavailableLocation = !current && openError === GFS_UNAVAILABLE_LOCATION_MESSAGE
// 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.
@@ -1556,6 +1558,9 @@ export function FilesPage({
) : null}
{accessibleNotice ? <StatusBanner tone="info" text={accessibleNotice} /> : null}
+ {unavailableLocation ? (
+ <StatusBanner tone="error" text={GFS_UNAVAILABLE_LOCATION_MESSAGE} />
+ ) : null}
{visibleError && !accessRevoked && !blockingFailure ? (
// 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
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index e3f3ddde0..b41ffeed8 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -13,7 +13,10 @@ const hookMock = vi.hoisted(() => ({
useGfsBrowserController: vi.fn(),
}))
-vi.mock('@hooks/domain/useGfsBrowserController', () => hookMock)
+vi.mock('@hooks/domain/useGfsBrowserController', () => ({
+ ...hookMock,
+ GFS_UNAVAILABLE_LOCATION_MESSAGE: 'This folder or file is no longer available.',
+}))
function baseController() {
return {
@@ -172,6 +175,17 @@ describe('FilesPage', () => {
expect(screen.queryByText(/Error invoking remote method/i)).toBeNull()
})
+ it('shows the non-sensitive unavailable state after the open folder is denied', () => {
+ hookMock.useGfsBrowserController.mockReturnValue({
+ ...baseController(),
+ openError: 'This folder or file is no longer available.',
+ })
+
+ renderFilesPage()
+
+ expect(screen.getByText('This folder or file is no longer available.')).toBeTruthy()
+ })
+
it.each([
['initial GFS discovery', { loadingAccessible: true }],
[