reuse useProjectsQuery instead of fetchProjectsAction in useEffect#2793
reuse useProjectsQuery instead of fetchProjectsAction in useEffect#2793dimaMachina merged 5 commits intomainfrom
useProjectsQuery instead of fetchProjectsAction in useEffect#2793Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9a0ce4b The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
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 |
|
TL;DR — Replaces manual Key changes
Summary | 14 files | 5 commits | base:
|
There was a problem hiding this comment.
Clean refactor — no issues found.
What it does:
- Replaces manual
useEffect+useStateproject-fetching in 3 stats pages with the existinguseProjectsQueryhook, eliminating ~60 lines of duplicated data-fetching logic. - Replaces inline
{ params: Promise<...> }type annotations in 7 trigger pages with the globally-availablePageProps<Route>type (generated by the Next.js TypeScript plugin). - Removes redundant local
type RouteContext<_T>definitions in 2 API route files in favor of the global Next.js-generatedRouteContext<Route>type. - Removes the now-unused
fetchProjectsActionserver action.
Verified:
useProjectsQueryreturnsProject[]withinitialData: [], sodatais always defined — no risk ofundefinedbreaking downstream.map()calls.fetchProjectsis still imported and used elsewhere (query hook, server utils, components) — only the server action wrapper was dead code.- No remaining references to
fetchProjectsAction(only a vestigial variable namefetchProjectsActionMockin a test file that actually mocksfetchProjects). useEffectimports remain in the stats pages since they're still used for other effects.PagePropsandRouteContextare ambient types from.next/types/— no imports needed.
There was a problem hiding this comment.
New commits look good — both are type-safety fixes that follow from adopting PageProps. The explicit destructuring annotation on searchParams preserves the narrow status union type, and the typeof guard correctly narrows string | string[] | undefined to string.
|
@claude --review and add a changeset |
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
This is a clean refactoring PR that eliminates duplicated data-fetching boilerplate and consolidates type declarations to use Next.js-generated types.
Changes Verified
1. useProjectsQuery replaces manual useEffect + fetchProjectsAction
- Three stats pages (
ai-calls/page.tsx,stats/page.tsx,tool-calls/page.tsx) now use the existinguseProjectsQueryhook - The hook provides
initialData: [], sodatais always defined — noundefinedrisk on downstream.map()calls useEffectimports are correctly retained where still needed for other effects
2. PageProps<Route> replaces inline type declarations
- Seven trigger pages adopt the globally-available
PageProps<Route>type - Type narrowing is correctly preserved:
invocations/page.tsx: Adds explicit destructuring annotation forstatusunion typenew/page.tsx: Addstypeofguard to narrowstring | string[] | undefinedtostring
3. Global RouteContext<Route> replaces local definitions
- Two API route files remove redundant local
type RouteContext<_T>definitions - Both routes now use the Next.js-generated ambient type
4. Dead code removal
fetchProjectsActionserver action is removed (no remaining references)- The underlying
fetchProjectsfunction is still imported where needed
✅ APPROVE
Summary: Clean refactoring that reduces ~130 lines of duplicated code by leveraging existing patterns. The type narrowing changes are correct and necessary for type safety with the more generic PageProps type.
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
Re-review Delta
The only change since the prior automated review is adding a changeset file:
.changeset/little-hounds-battle.md ✅
- Package:
@inkeep/agents-manage-ui— correct (only UI package changed) - Bump:
patch— appropriate for refactoring with no breaking changes - Message follows repo guidelines (sentence case, action verb, describes the change)
✅ APPROVE
Summary: Changeset is well-formed. Prior review already approved the refactoring changes — this commit completes the PR by adding the required changeset.
Reviewers (1)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
orchestrator |
1 | 0 | 0 | 0 | 0 | 0 | 0 |
| Total | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
Note: Sub-reviewers not dispatched — delta was trivial (changeset file only).
…ct` (#2793) * reuse `useProjectsQuery` instead of `fetchProjectsAction` in `useEffect` * format * upd * fix lint * Create little-hounds-battle.md

No description provided.