fix(studio): SliderWithTextInput doesn't accept out of range partial inputs - #1111
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
📝 WalkthroughWalkthroughThe numeric input flow preserves draft text during editing, commits valid values, and clamps out-of-range values on blur. Tests cover slider events, decimal prefixes, controlled temperature updates, and advanced parameter bounds. ChangesNumeric input handling
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/common/src/components/SliderWithTextInput/index.tsx (1)
19-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
import typefor type-only symbols.
ComponentPropsandReactNodeare only used as types.Proposed fix
-import { ComponentProps, ReactNode, useState } from 'react'; +import { useState } from 'react'; +import type { ComponentProps, ReactNode } from 'react';As per coding guidelines, “Use
import typefor type-only imports.”🤖 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/common/src/components/SliderWithTextInput/index.tsx` at line 19, Update the import in the SliderWithTextInput component so ComponentProps and ReactNode are imported with import type, while keeping useState as the regular runtime import.Source: Coding guidelines
🤖 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.
Inline comments:
In `@web/packages/common/src/components/SliderWithTextInput/index.tsx`:
- Around line 84-95: The handleTextInputBlur function must not invoke
attributes?.Slider?.onValueChange?. Remove that callback invocation while
preserving the existing parsing, clamping, equality check, and field.onChange
behavior; text-input updates should continue through the TextInput callback
path.
---
Nitpick comments:
In `@web/packages/common/src/components/SliderWithTextInput/index.tsx`:
- Line 19: Update the import in the SliderWithTextInput component so
ComponentProps and ReactNode are imported with import type, while keeping
useState as the regular runtime import.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 1425855e-89e1-46be-bb94-3f9876eff086
📒 Files selected for processing (3)
web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsxweb/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsxweb/packages/common/src/components/SliderWithTextInput/index.tsx
|
f812daf to
bd60b45
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@web/packages/common/src/components/SliderWithTextInput/index.tsx`:
- Line 19: Update the imports in SliderWithTextInput to use type-only imports
for ComponentProps, ReactNode, FieldValues, FormFieldProps, and TextInputProps,
while keeping runtime imports such as useState as regular imports.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 976a1373-e84e-41c9-bfe1-9c9bfc06ccb4
📒 Files selected for processing (4)
web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsxweb/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsxweb/packages/common/src/components/SliderWithTextInput/index.tsxweb/packages/studio/src/routes/SafeSynthesizerNewRoute/components/AdvancedParameters.test.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- web/packages/studio/src/routes/SafeSynthesizerNewRoute/components/AdvancedParameters.test.tsx
- web/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsx
- web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsx
…inputs Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
bd60b45 to
6d93ac5
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/packages/common/src/utils/math.ts (1)
4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the explicit return type.
clampis a public API. Declare itsnumberreturn type to follow the TypeScript guidelines and make the contract clear.Proposed fix
-export const clamp = (value: number, min: number, max: number) => +export const clamp = (value: number, min: number, max: number): number => Math.min(Math.max(value, min), max);🤖 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/common/src/utils/math.ts` around lines 4 - 5, Update the public clamp function’s signature to explicitly declare a number return type, while preserving its existing Math.min/Math.max behavior.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@web/packages/common/src/utils/math.ts`:
- Around line 4-5: Update the public clamp function’s signature to explicitly
declare a number return type, while preserving its existing Math.min/Math.max
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 37bc8493-9256-4dba-8857-65c5a2fe9b8d
📒 Files selected for processing (5)
web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsxweb/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsxweb/packages/common/src/components/SliderWithTextInput/index.tsxweb/packages/common/src/utils/math.tsweb/packages/studio/src/routes/SafeSynthesizerNewRoute/components/AdvancedParameters.test.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
- web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsx
- web/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsx
- web/packages/common/src/components/SliderWithTextInput/index.tsx
- web/packages/studio/src/routes/SafeSynthesizerNewRoute/components/AdvancedParameters.test.tsx
Signed-off-by: Sean Teramae steramae@nvidia.com
Summary by CodeRabbit