Repository navigation
refactor(ai): AI status in overview settings page - #857
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
React Doctor found 4 new issues in 3 files · 4 warnings · score 90 / 100 (Great) · 2 fixed · vs 4 warnings
Reviewed by React Doctor for commit |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c32577b38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,8 @@ | |||
| import { createFileRoute } from '@tanstack/react-router' | |||
|
|
|||
| import { AiUnlimitedProto } from '@/proto/ai-unlimited/harness' | |||
There was a problem hiding this comment.
Keep route modules topology-only
This route directly imports and mounts an app-local prototype screen, contrary to the repository requirement that route modules contain only topology and that screens and namespaces live behind @vitnode/core/tanstack/*. Move the screen behind the prescribed TanStack module and leave this file with route metadata and loaders only.
AGENTS.md reference: AGENTS.md:L31-L31
Useful? React with 👍 / 👎.
| .max(USER_HEADLINE_MAX_LENGTH) | ||
| .default(user.headline ?? ""), | ||
| showRealName: z.boolean().default(user.showRealName), | ||
| timeZone: z.enum(zones as [string, ...string[]]).default(initialTimeZone), |
There was a problem hiding this comment.
Preserve stored time zones in the form enum
When Intl.supportedValuesOf is unavailable, or the account stores a valid IANA alias absent from the browser's returned list, initialTimeZone is not a member of this enum. Submitting the combined sheet then fails time-zone validation even when the user only changed an unrelated name or phone field. Include the stored value in zones and its labels, or avoid browser-enum validation for an unchanged server value.
Useful? React with 👍 / 👎.
| .map(action => ({ action, points: Number(action.monthPoints) })) | ||
| .filter(({ points }) => points > 0) | ||
| .sort((a, b) => b.points - a.points); | ||
| const total = used.reduce((sum, { points }) => sum + points, 0); |
There was a problem hiding this comment.
Account for usage from unavailable AI actions
When a user spent points on an action that is later disabled or whose permission is revoked, loadUserAiUsage still includes those charges in points.used but omits that action from actions (usage-summary.ts filters at lines 148–165). Computing the denominator solely from the remaining actions makes their percentages add up to 100% while the displayed point rows do not equal the monthly total. Pass the overall used total into the breakdown and represent the residual usage as an “other” segment.
Useful? React with 👍 / 👎.
|
|
||
| export const formatPoints = (value: number) => { | ||
| if (value > 0 && value < 0.1) return '<0.1' | ||
| return new Intl.NumberFormat('en', { maximumFractionDigits: 1 }).format(Math.floor(value * 10) / 10) |
There was a problem hiding this comment.
React Doctor · react-doctor/js-hoist-intl (warning)
This is slow because new Intl.NumberFormat() rebuilds on every call inside a function, so move it to the top of the file, or wrap it in useMemo
Fix → Move new Intl.NumberFormat(...) to the top of the file or wrap it in useMemo. Building one is slow, so don't redo it on every call
| } | ||
|
|
||
| export const formatDay = (date: Date) => | ||
| new Intl.DateTimeFormat('en', { day: 'numeric', month: 'long' }).format(date) |
There was a problem hiding this comment.
React Doctor · react-doctor/js-hoist-intl (warning)
This is slow because new Intl.DateTimeFormat() rebuilds on every call inside a function, so move it to the top of the file, or wrap it in useMemo
Fix → Move new Intl.NumberFormat(...) to the top of the file or wrap it in useMemo. Building one is slow, so don't redo it on every call
| } | ||
| document.addEventListener('keydown', onKey) | ||
| return () => document.removeEventListener('keydown', onKey) | ||
| }, [active, onChange]) |
There was a problem hiding this comment.
React Doctor · react-doctor/prefer-use-effect-event (warning)
Your effect re-subscribes whenever "onChange" changes, even though it's only used inside addEventListener.
Fix → Wrap the callback with useEffectEvent(callback) (React 19.2+) and call it inside the sub-handler. An Effect Event always sees the latest props and state but isn't a dependency, so the effect won't re-subscribe every time the parent redraws. See https://react.dev/reference/react/useEffectEvent
| ? [] | ||
| : routes.filter(route => isAdminRoute(route) && route.mode === "dynamic"); | ||
| const lines: RouteLine[] = routes | ||
| .filter(route => !collapsed.includes(route)) |
There was a problem hiding this comment.
React Doctor · react-doctor/js-set-map-lookups (warning)
This scales poorly because array.includes() inside a loop scans the whole list every time. Use a Set for constant-time lookups.
Fix → Use a Set or Map when you check for the same items over and over. Array.includes/find scans the whole list each time
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5cf987969
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| specifier, | ||
| })), | ||
| contentRegistry: contentRegistry.modules, | ||
| hostRoutes, |
There was a problem hiding this comment.
Preserve host routes with supported file syntax
When an app uses TanStack's escaped-dot or optional-parameter filename syntax, this exposes the intentionally conservative readHostRoutes result to the new report even though its parser drops every file containing an unrecognized token. The current app demonstrates the regression: llms[.]txt.ts, llms-full[.]txt.ts, and docs.{$}[.]md.ts are present in routeTree.gen.ts, but never enter hostRoutes, so vitnode build silently omits real routes from the advertised all-routes summary. Build the report from the generated route tree or extend discovery to cover all supported file-route syntax.
Useful? React with 👍 / 👎.
Improving Documentation
pnpm lint:fixto fix formatting issues before opening the PR.Description
What?
Why?