Skip to content

fix(select): remove asChild usage in SelectPrimitive.Icon#13929

Open
hjben wants to merge 2 commits into
langflow-ai:release-1.11.0from
hjben:release-1.11.0
Open

fix(select): remove asChild usage in SelectPrimitive.Icon#13929
hjben wants to merge 2 commits into
langflow-ai:release-1.11.0from
hjben:release-1.11.0

Conversation

@hjben

@hjben hjben commented Jul 1, 2026

Copy link
Copy Markdown

Summary

This PR addresses UI runtime rendering issues observed after upgrading @radix-ui/react-slot from ^1.2.4 to v1.3.0.

After the upgrade, stricter type safety and improved component composition rules in @radix-ui/react-slot@1.3.0 exposed previously implicit or unsafe usage patterns in the Select component. These patterns led to runtime rendering issues in specific composition scenarios.

This PR updates the implementation to align with safer and more explicit Slot composition patterns, improving compatibility with the current Radix version and ensuring resilience against future updates.


Changes

Fix Slot usage in Select Icon component

File: src/frontend/src/components/ui/select-custom.tsx

Before:

<SelectPrimitive.Icon asChild>

After:

<SelectPrimitive.Icon>

Why this change is needed

SelectPrimitive.Icon does not require asChild because it does not rely on external children injection.

Removing asChild ensures correct Slot composition behavior and avoids relying on implicit child injection patterns that may not be compatible with stricter Slot composition rules introduced in @radix-ui/react-slot@1.3.0.


Motivation

The upgrade to @radix-ui/react-slot@1.3.0 introduced stricter enforcement of Slot composition correctness and improved handling of edge cases in component structure.

While this is not a breaking API change, it surfaced previously valid but implicit usage patterns that were not fully aligned with the updated composition model.

This PR resolves these issues by adopting explicit and safe Slot usage patterns.


Behavior Impact

  • No changes to public API
  • No changes to visual UI behavior
  • Purely structural adjustment for compatibility and correctness

Notes

This change improves forward compatibility with future versions of @radix-ui/react-slot by ensuring explicit and valid Slot composition usage.

Summary by CodeRabbit

  • Bug Fixes

    • Improved the custom select control so the trigger icon renders reliably without affecting the overall dropdown behavior.
    • Addressed rendering stability issues for select content and items in common usage patterns.
  • Tests

    • Added coverage to verify the custom select components render safely and display placeholder text as expected.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a13eb96c-b196-4fe5-aa08-6c60a167f995

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Removes the asChild prop from SelectPrimitive.Icon within SelectTrigger, changing icon rendering from slot-based composition to default rendering. Adds a new test suite validating runtime compatibility of SelectTrigger, SelectContent, and SelectItem components.

Changes

Select Icon Compatibility Fix

Layer / File(s) Summary
Icon rendering fix and compatibility tests
src/frontend/src/components/ui/select-custom.tsx, src/frontend/src/components/ui/__tests__/select-custom.test.tsx
SelectPrimitive.Icon no longer uses asChild in SelectTrigger; new tests verify SelectTrigger, SelectContent, and SelectItem render without crashing under slot composition.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Quality And Coverage ⚠️ Warning The new tests are smoke-only: they check rendering doesn’t throw and placeholder text appears, but never verify the icon, menu opening, or selection behavior. Add behavior-focused tests that open the select, assert the trigger icon renders, and verify content/item selection with user interaction; keep the a11y-style pattern.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: removing asChild from SelectPrimitive.Icon in the Select component.
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.
Test Coverage For New Implementations ✅ Passed Added a real frontend select-custom.test.tsx regression suite that exercises the updated Select components and matches repo naming patterns.
Test File Naming And Structure ✅ Passed PASS: select-custom.test.tsx follows repo Jest patterns (__tests__/*.test.tsx), uses clear describe/it names, and is covered by jest.config.js.
Excessive Mock Usage Warning ✅ Passed The new tests use real Select components and Testing Library renders only; no jest/vi mocks or test doubles are present.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 1, 2026

@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)
src/frontend/src/components/ui/__tests__/select-custom.test.tsx (1)

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

Tests don't assert the icon actually renders.

These tests only check that rendering doesn't throw and that trigger text appears, but the actual change under test is icon composition (SelectPrimitive.Icon). None of the assertions verify the icon element is present in the DOM, so this suite would not catch a regression where the icon disappears (as currently happens in select-custom.tsx).

Consider adding an assertion checking for the icon's presence (e.g., via data-testid or role/svg query) in renderSelect.
As per path instructions, frontend tests should "verify the tests actually cover the new or changed behavior rather than acting as placeholders."

🤖 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 `@src/frontend/src/components/ui/__tests__/select-custom.test.tsx` around lines
12 - 31, The Select tests only validate that rendering succeeds and text is
present, but they do not cover the icon composition introduced via
SelectPrimitive.Icon. Update the Select - Radix Slot 1.3.0 compatibility suite
in renderSelect to assert that the icon is actually rendered in the DOM, using a
stable query such as a test id or svg/role lookup. Keep the existing checks, but
add an explicit icon-presence assertion so this test fails if the icon
disappears from select-custom.tsx.

Source: Path instructions

🤖 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 `@src/frontend/src/components/ui/select-custom.tsx`:
- Line 23: The Select icon wrapper was left empty in SelectCustom, so the
dropdown indicator no longer renders. Update SelectPrimitive.Icon in
select-custom.tsx to keep a real icon element as its direct child, and remove
only the asChild usage while preserving the previous chevron-style icon
behavior.

---

Nitpick comments:
In `@src/frontend/src/components/ui/__tests__/select-custom.test.tsx`:
- Around line 12-31: The Select tests only validate that rendering succeeds and
text is present, but they do not cover the icon composition introduced via
SelectPrimitive.Icon. Update the Select - Radix Slot 1.3.0 compatibility suite
in renderSelect to assert that the icon is actually rendered in the DOM, using a
stable query such as a test id or svg/role lookup. Keep the existing checks, but
add an explicit icon-presence assertion so this test fails if the icon
disappears from select-custom.tsx.
🪄 Autofix (Beta)

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: Pro

Run ID: f735e55d-a478-425f-8e38-05e2cc67dacc

📥 Commits

Reviewing files that changed from the base of the PR and between 869627a and b5ab4f9.

📒 Files selected for processing (2)
  • src/frontend/src/components/ui/__tests__/select-custom.test.tsx
  • src/frontend/src/components/ui/select-custom.tsx
>
{children}
<SelectPrimitive.Icon asChild></SelectPrimitive.Icon>
<SelectPrimitive.Icon></SelectPrimitive.Icon>

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.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Icon child was dropped, not just asChild.

The fix should remove asChild while keeping the icon element as a regular child of SelectPrimitive.Icon. As written, <SelectPrimitive.Icon></SelectPrimitive.Icon> has no children at all, so the dropdown icon will no longer render — contradicting the PR's claim that visual UI behavior is unaffected.

🐛 Proposed fix
-    <SelectPrimitive.Icon></SelectPrimitive.Icon>
+    <SelectPrimitive.Icon>
+      <ChevronDownIcon />
+    </SelectPrimitive.Icon>

Please restore whatever icon element was previously passed via asChild (e.g. a chevron icon) as a direct child.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<SelectPrimitive.Icon></SelectPrimitive.Icon>
<SelectPrimitive.Icon>
<ChevronDownIcon />
</SelectPrimitive.Icon>
🤖 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 `@src/frontend/src/components/ui/select-custom.tsx` at line 23, The Select icon
wrapper was left empty in SelectCustom, so the dropdown indicator no longer
renders. Update SelectPrimitive.Icon in select-custom.tsx to keep a real icon
element as its direct child, and remove only the asChild usage while preserving
the previous chevron-style icon behavior.
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

1 participant