Skip to content

fix(studio): SliderWithTextInput doesn't accept out of range partial inputs - #1111

Merged
steramae-nvidia merged 3 commits into
mainfrom
steramae/fix-slider-inputs
Aug 10, 2026
Merged

fix(studio): SliderWithTextInput doesn't accept out of range partial inputs#1111
steramae-nvidia merged 3 commits into
mainfrom
steramae/fix-slider-inputs

Conversation

@steramae-nvidia

@steramae-nvidia steramae-nvidia commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Sean Teramae steramae@nvidia.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved numeric slider inputs so values can be cleared and replaced more easily.
    • Users can now enter intermediate values without immediate clamping or unwanted formatting.
    • Out-of-range values are corrected when editing is complete.
    • Invalid input remains visible while editing instead of being unexpectedly discarded.
    • Slider and reset interactions now consistently update the associated text field.
    • Decimal values can be entered more reliably, including values typed in stages.

@steramae-nvidia

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@steramae-nvidia
steramae-nvidia requested review from a team as code owners August 5, 2026 21:19
@github-actions github-actions Bot added the fix label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Numeric input handling

Layer / File(s) Summary
Draft input and commit behavior
web/packages/common/src/utils/math.ts, web/packages/common/src/components/SliderWithTextInput/index.tsx
The shared clamp utility bounds numeric values. The component preserves draft text, commits valid values, clamps drafts on blur, and clears drafts after slider or reset changes.
Interaction and state validation
web/packages/common/src/components/SliderWithTextInput/SliderWithTextInput.test.tsx, web/packages/common/src/components/ModelSelectV2/InferenceParameters.test.tsx, web/packages/studio/src/routes/SafeSynthesizerNewRoute/components/AdvancedParameters.test.tsx
Tests cover slider input events, editable out-of-range prefixes, blur clamping, decimal values, controlled temperature updates, and advanced parameter bounds.

Suggested reviewers: aray12

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change to accept out-of-range partial inputs in SliderWithTextInput.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch steramae/fix-slider-inputs

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/packages/common/src/components/SliderWithTextInput/index.tsx (1)

19-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use import type for type-only symbols.

ComponentProps and ReactNode are 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 type for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 73670d7 and 9902e17.

📒 Files selected for processing (3)
  • 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

Comment thread web/packages/common/src/components/SliderWithTextInput/index.tsx
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 31964/40579 78.8% 63.5%
Integration Tests 18538/38505 48.1% 20.8%

@steramae-nvidia
steramae-nvidia force-pushed the steramae/fix-slider-inputs branch from f812daf to bd60b45 Compare August 7, 2026 18:38
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c0dbe85 and bd60b45.

📒 Files selected for processing (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
🚧 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

Comment thread web/packages/common/src/components/SliderWithTextInput/index.tsx
Comment thread web/packages/common/src/components/SliderWithTextInput/index.tsx Outdated
…inputs

Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Sean Teramae <steramae@nvidia.com>
@steramae-nvidia
steramae-nvidia force-pushed the steramae/fix-slider-inputs branch from bd60b45 to 6d93ac5 Compare August 10, 2026 19:13
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/packages/common/src/utils/math.ts (1)

4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the explicit return type.

clamp is a public API. Declare its number return 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

📥 Commits

Reviewing files that changed from the base of the PR and between f365be9 and 6d93ac5.

📒 Files selected for processing (5)
  • 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/common/src/utils/math.ts
  • web/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

@steramae-nvidia
steramae-nvidia added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit bc29012 Aug 10, 2026
57 of 98 checks passed
@steramae-nvidia
steramae-nvidia deleted the steramae/fix-slider-inputs branch August 10, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants