Skip to content

Fix: Preserve the text format returned by the API. - #18167

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
cike8899:fix-multi-chat
Aug 12, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
cike8899:fix-multi-chat

Conversation

@cike8899

Copy link
Copy Markdown
Contributor

Summary

Fix: Preserve the text format returned by the API.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧰 typescript Pull requests that update Typescript code labels Aug 12, 2026
@cike8899
cike8899 requested a review from wangq8 August 12, 2026 08:53
@cike8899 cike8899 added the ci Continue Integration label Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The changes add ref forwarding to TopSelect and preserve whitespace and line breaks in dataset testing results.

Changes

UI updates

Layer / File(s) Summary
TopSelect ref forwarding
web/src/components/top-select.tsx
TopSelect now uses forwardRef and passes the ref to SelectWithSearch. Existing option, value, translation, and change handling remain unchanged.
Testing result whitespace rendering
web/src/pages/dataset/testing/testing-result.tsx
The chunk content paragraph now uses whitespace-pre-wrap to preserve whitespace and line breaks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a ref in hand,
Selections now respond as planned.
Newlines hop and spaces stay,
Chunk text keeps its shape all day.
Squeak, review, and ship away!

🚥 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.
Title check ✅ Passed The title clearly describes the primary change: preserving text formatting returned by the API.
Description check ✅ Passed The description includes the required Summary section and states the PR objective, but provides limited background context.

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.

❤️ Share

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

@cike8899
cike8899 marked this pull request as draft August 12, 2026 08:53
@cike8899
cike8899 marked this pull request as ready for review August 12, 2026 08:53

@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/src/components/top-select.tsx (1)

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

Extract the inline onChange handler.

Define a named handleChange function and pass it to SelectWithSearch. Keep the existing Number(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={() => ...} and onChange={(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

📥 Commits

Reviewing files that changed from the base of the PR and between eada2f6 and cc1db83.

📒 Files selected for processing (2)
  • web/src/components/top-select.tsx
  • web/src/pages/dataset/testing/testing-result.tsx

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@wangq8
wangq8 merged commit 5b701f2 into infiniflow:main Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants