Skip to content

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

TypeScript

fix(desktop): r1-m1 provide query context on the merged app harnesses

Mc2b769f7f889
diff --git a/desktop-app/ui/src/__tests__/App.activationSeam.test.tsx b/desktop-app/ui/src/__tests__/App.activationSeam.test.tsx
index a40d6fd56..b149c6fdf 100644
--- a/desktop-app/ui/src/__tests__/App.activationSeam.test.tsx
+++ b/desktop-app/ui/src/__tests__/App.activationSeam.test.tsx
@@ -1,12 +1,14 @@
// @vitest-environment jsdom
import { useReducer } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { readFileSync, readdirSync, statSync } from 'node:fs'
import { join, relative } from 'node:path'
import { DESKTOP_ROUTES } from '@constants/navigation'
import { useAppController } from '@hooks/useAppController'
import type { GfsPreviewResource } from '@lib/gfsPreview'
+import { desktopQueryDefaults } from '@lib/queryClient'
import { toActiveSandboxUiApps } from '@lib/sandboxUiAppSelection'
import type { SandboxUiAppListing } from '@lib/sandboxUiAppSelection.types'
import {
@@ -419,7 +421,15 @@ describe('App activates app tabs only through its activation seam', () => {
}
async function renderApp() {
- render(<App />)
+ // App mounts GfsDragSessionProvider, which reads Query state: the render
+ // needs a real QueryClient (fresh per render, production cache defaults)
+ // instead of the app-level singleton provider it gets in production.
+ const queryClient = new QueryClient({ defaultOptions: desktopQueryDefaults })
+ render(<App />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
+ ),
+ })
await waitFor(() => expect(sandboxUi.listApps).toHaveBeenCalled())
await act(async () => {
await Promise.resolve()
diff --git a/desktop-app/ui/src/__tests__/App.sandboxUiOwnership.test.tsx b/desktop-app/ui/src/__tests__/App.sandboxUiOwnership.test.tsx
index f4701e8b6..c0bb2d051 100644
--- a/desktop-app/ui/src/__tests__/App.sandboxUiOwnership.test.tsx
+++ b/desktop-app/ui/src/__tests__/App.sandboxUiOwnership.test.tsx
@@ -556,7 +556,10 @@ describe('App wires gestures and main events to the embed ownership machine', ()
await flushMacrotask()
expect(sandboxUi.close).toHaveBeenCalledWith({ launchId: first })
- expect(tabOf(ALPHA!.appRef)?.app?.savedRoutePath).toBe('/inbox')
+ // The saved route lands with the deactivation continuation, which can
+ // commit a tick after the close under load: wait for the store write
+ // instead of sampling it once.
+ await waitFor(() => expect(tabOf(ALPHA!.appRef)?.app?.savedRoutePath).toBe('/inbox'))
fireEvent.click(screen.getByRole('button', { name: 'Alpha', pressed: false }))
await waitFor(() => expect(sandboxUi.open).toHaveBeenCalledTimes(2))