refactor(web): organize devtools components#159
Conversation
… for devtool loaders
Review Summary by QodoStandardize devtools loading with dedicated loader components
WalkthroughsDescription• Standardize devtools loading with dedicated loader components • Create separate loader files for React Scan and TanStack devtools • Implement lazy loading and error handling for devtools • Remove devtools barrel imports and use direct paths • Consolidate devtools initialization logic in dedicated loaders Diagramflowchart LR
A["Devtools Components"] -->|"Create Loaders"| B["ReactScanLoader"]
A -->|"Create Loaders"| C["TanStackDevtoolsLoader"]
D["layout.tsx"] -->|"Import from"| B
E["query-client.tsx"] -->|"Import from"| C
B -->|"Lazy load with error handling"| F["React Scan"]
C -->|"Lazy load with Suspense"| G["TanStack Devtools"]
File Changes1. web/app/components/devtools/react-scan/loader.tsx
|
Code Review by Qodo
1. console.error in ReactScanLoader
|
| })).catch((error) => { | ||
| console.error('Failed to load React Scan devtools:', error) | ||
| return { default: () => null } |
There was a problem hiding this comment.
1. console.error in reactscanloader 📘 Rule violation ✧ Quality
New frontend code logs errors using console.error, which violates the no-console requirement for production code. This can leak debug output into production bundles and fails the no-console lint rule.
Agent Prompt
## Issue description
`console.error` is used in a frontend production code path, which violates the project's `no-console` compliance requirement.
## Issue Context
This loader is imported from `web/app/layout.tsx`, so it is part of the app bundle even if gated by `IS_DEV` at runtime.
## Fix Focus Areas
- web/app/components/devtools/react-scan/loader.tsx[6-12]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| return null | ||
|
|
||
| return ( | ||
| <Suspense fallback={<div className="text-xs text-gray-500">Loading devtools...</div>}> |
There was a problem hiding this comment.
2. Hardcoded "loading devtools..." 📘 Rule violation ✓ Correctness
A user-facing loading message is hardcoded in a React component instead of being sourced from i18n translations. This prevents localization and violates the i18n compliance rule.
Agent Prompt
## Issue description
The Suspense fallback contains a hardcoded user-facing string (`Loading devtools...`) instead of an i18n translation.
## Issue Context
Compliance requires user-facing strings to be defined in `web/i18n/en-US/` and accessed via `useTranslation` with proper namespace options.
## Fix Focus Areas
- web/app/components/devtools/react-scan/loader.tsx[15-22]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const TanStackDevtoolsWrapper = lazy(() => | ||
| import('./devtools').then(module => ({ | ||
| default: module.TanStackDevtoolsWrapper, | ||
| })).catch(() => { | ||
| return { default: () => null } | ||
| }), |
There was a problem hiding this comment.
3. Silent devtools load failure 🐞 Bug ✧ Quality
TanStackDevtoolsLoader swallows lazy-import failures and renders a null component without any console output, so developers get no signal when the devtools fail to load. This makes diagnosing missing dependencies/incorrect paths during development significantly harder.
Agent Prompt
### Issue description
`TanStackDevtoolsLoader` currently swallows dynamic import failures and falls back to a null component without logging. In development, this makes devtools failing to load indistinguishable from “devtools not enabled”.
### Issue Context
`ReactScanLoader` already logs import failures, but the TanStack equivalent does not, creating inconsistent and low-observability behavior for dev-only tooling.
### Fix Focus Areas
- web/app/components/devtools/tanstack/loader.tsx[6-11]
### Suggested change
Update the catch handler to accept the error and log it (or optionally rethrow after logging), e.g.
```ts
.catch((error) => {
console.error('Failed to load TanStack devtools:', error)
return { default: () => null }
})
```
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#8