Repository navigation
feat: implement caching for Environments and Schedules pages using React Query - #1246
Conversation
…/react-query-server-client
…ore asserting presence of menu item
…ackage.json, including vite to 6.4.5
🦋 Changeset detectedLatest commit: 91e911e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…schedul-page Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # packages/trueforge-ui/src/atoms/environments/EnvironmentsPage.tsx # packages/trueforge-ui/src/atoms/schedules/SchedulesPage.tsx # packages/trueforge-ui/test/atoms/schedules/SchedulesPage.test.tsx # packages/trueforge-ui/test/server/queryClient.test.tsx # pnpm-lock.yaml
|
…flag changes Co-authored-by: Cursor <cursoragent@cursor.com>
Ignore pagination cursors from placeholder data, show only the pinned schedule whose id matches, surface failed run lists instead of caching them as empty, and drop the meta type assertion in permissions placeholder data. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cc97e08. Configure here.
| } | ||
| wasSettingsOpenRef.current = settingsOpen; | ||
| }, [settingsOpen, loadEnvironments, pageToken, pageSize]); | ||
| }, [settingsOpen, refetchEnvironments]); |
There was a problem hiding this comment.
Stale environment pages after updates
Low Severity
Closing settings only refetches the active environments list query, and pending-build polling only setQueryDatas that same key. Other cached environments.list entries (different page size or token) stay fresh for staleTime and can still show old rows or pending status. Create, update, and delete already invalidate queryKeys.environments.all().
Additional Locations (1)
Reviewed by Cursor Bugbot for commit cc97e08. Configure here.


Summary
Closes #
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
Medium Risk
Touches permission caching and list consistency for admin-style pages; behavior is fail-closed on permission expansion failures but could briefly show stale grants during refetch.
Overview
Environments and Schedules no longer fetch lists, details, and runs through local
useStateloaders. They now read through the shared server React Query client (useQuery/useQueries,keepPreviousData), with scoped pagination cursors so page tokens reset when page size or agent filter changes and nav stays disabled while placeholder data is loading.Mutations (create, update, delete, run now, flags) invalidate the relevant query keys instead of manually reloading; environment pending-status polling patches the cached list via
setQueryData.useResourcePermissionsis moved onto React Query as well, reusing prior grants while the id set grows and failing closed on server swaps or failed expansions.Unit tests cover list cache reuse on remount, refetch/invalidation after delete, pagination cursor safety, pinned-schedule transitions, and run-history error handling.
Reviewed by Cursor Bugbot for commit cc97e08. Bugbot is set up for automated code reviews on this repo. Configure here.