perf(studio): memoize Data Designer builder panes - #1018
Conversation
Wrap the builder's presentational panes in React.memo and stabilize the callbacks the build route hands them, so editing a column no longer re-renders the toolbar, palette, and config pane on every keystroke. SchemaRow/SchemaList now take id-taking handlers instead of pre-bound closures, so memoized rows keep referential equality across renders. Signed-off-by: Sean Teramae <steramae@nvidia.com>
📝 WalkthroughWalkthroughChangesData Designer builder updates
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx (1)
152-175: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winDo not hide local submission errors in the mutation catch.
buildDataDesignerConfig(...)andnavigate(...)execute inside the sametryascreateJob.mutateAsync. If either local operation throws, the catch only opens the details panel.createJob.errorremains unset, sosubmitErrorstaysnulland the user sees no failure message.Build the config before the mutation
try, or surface build errors through a separate error state.Proposed scope fix
+ const config = buildDataDesignerConfig(columns, models, servedModelNames); try { const created = await createJob.mutateAsync({ workspace, data: { name, spec: { num_records: Number(rows), - config: buildDataDesignerConfig(columns, models, servedModelNames), + config, }, }, });Based on learnings, isolate non-mutation build/runtime work from the submit catch so it cannot cause a silent UX regression.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx` around lines 152 - 175, Move buildDataDesignerConfig execution in handleSubmit outside the try/catch that surrounds createJob.mutateAsync, while keeping the mutation error handling focused on submission failures. Ensure local build or navigation errors are not caught and converted into only setIsDetailsOpen(true), preserving visible mutation error reporting through createJob.error and submitError.Source: Learnings
🧹 Nitpick comments (1)
web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx (1)
143-147: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUse stable hook members as callback dependencies.
useJobBuilderreturns a new object on every render. The[builder]dependencies therefore recreate the toolbar and configuration-pane callbacks, which prevents theirmemowrappers from skipping renders. Destructure the stable methods and selected IDs, then depend on those values.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx` around lines 143 - 147, Update the callbacks around handlePreview and the related toolbar/configuration-pane handlers to destructure the stable methods and selected IDs returned by useJobBuilder instead of depending on the recreated builder object. Use those destructured values in each useCallback dependency array so memoized children can skip unnecessary renders while preserving existing behavior.Source: MCP tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx`:
- Around line 152-175: Move buildDataDesignerConfig execution in handleSubmit
outside the try/catch that surrounds createJob.mutateAsync, while keeping the
mutation error handling focused on submission failures. Ensure local build or
navigation errors are not caught and converted into only setIsDetailsOpen(true),
preserving visible mutation error reporting through createJob.error and
submitError.
---
Nitpick comments:
In `@web/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx`:
- Around line 143-147: Update the callbacks around handlePreview and the related
toolbar/configuration-pane handlers to destructure the stable methods and
selected IDs returned by useJobBuilder instead of depending on the recreated
builder object. Use those destructured values in each useCallback dependency
array so memoized children can skip unnecessary renders while preserving
existing behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 9447a21e-3c45-4607-b71d-fe30f6fa1909
📒 Files selected for processing (7)
web/packages/studio/src/routes/DataDesignerJobBuildRoute/BuilderConfigPane.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/BuilderDetailsPanel.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/BuilderPalette.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/BuilderToolbar.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/SchemaList.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/SchemaRow.tsxweb/packages/studio/src/routes/DataDesignerJobBuildRoute/index.tsx
|
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
What
Wraps the Data Designer builder's presentational panes in
React.memoand stabilizes the callbacks the build route passes them, so typing in a column config no longer re-renders the toolbar, palette, schema list, and config pane on every keystroke.SchemaRow/SchemaListnow take id-taking handlers (onSelect(id)) instead of pre-bound closures — otherwise every row got a fresh callback each render andmemowould never hit.Why
Split out of a larger Data Designer branch. This is a pure performance change with no behavior difference, so it can land and be verified independently of the AI-generation feature it was originally bundled with.
Testing
pnpm --filter nemo-studio-ui typecheck— cleanpnpm --filter nemo-studio-ui test src/routes/DataDesignerJobBuildRoute— passing🤖 Generated with Claude Code
Summary by CodeRabbit