Repository navigation
Fix: Preserve the text format returned by the API. - #18167
Conversation
📝 WalkthroughWalkthroughThe changes add ref forwarding to ChangesUI updates
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/components/top-select.tsx (1)
43-43: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the inline
onChangehandler.Define a named
handleChangefunction and pass it toSelectWithSearch. Keep the existingNumber(val)conversion. Run the touched-package lint or type-check after the change.As per coding guidelines: “Avoid inline JSX event handlers such as
onClick={() => ...}andonChange={(e) => ...}; extract named handlers and reference them by name.”Proposed change
+ const handleChange = (val: string) => { + onChange?.(Number(val)); + }; + return ( <SelectWithSearch ref={ref} options={sizeChangerOptions} value={value.toString()} - onChange={(val) => onChange?.(Number(val))} + onChange={handleChange} ></SelectWithSearch>🤖 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/src/components/top-select.tsx` at line 43, In the component containing SelectWithSearch, extract the inline onChange callback into a named handleChange function, preserving the Number(val) conversion and optional parent onChange invocation, then pass handleChange to the component and run the touched-package lint or type-check.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/src/components/top-select.tsx`:
- Line 43: In the component containing SelectWithSearch, extract the inline
onChange callback into a named handleChange function, preserving the Number(val)
conversion and optional parent onChange invocation, then pass handleChange to
the component and run the touched-package lint or type-check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: afc56794-54af-4d1e-9099-1d77559d4b52
📒 Files selected for processing (2)
web/src/components/top-select.tsxweb/src/pages/dataset/testing/testing-result.tsx
wangq8
left a comment
There was a problem hiding this comment.
Two changes in this PR:
testing-result.tsx — Adding whitespace-pre-wrap is the right fix for preserving line breaks and whitespace in chunk content returned by the API. Without it, multi-line text collapses into a single blob. This matches the PR title well.
top-select.tsx — Converting to forwardRef and passing the ref to SelectWithSearch is fine and enables consumers to attach a ref (e.g., for PopoverTrigger anchoring via Radix/shadcn). However, this change is unrelated to the PR title about preserving text format. In the current callers (search-view.tsx and testing-form.tsx), the TopSelect is used without a ref, so nothing would break, but nothing is explicitly fixed by it either.
If the forwardRef is needed for a follow-up or a separate fix, consider noting it in the description. Otherwise the code looks correct.
Approved with the note above.
Summary
Fix: Preserve the text format returned by the API.