Conversation
Greptile OverviewGreptile SummaryFixed infinite re-render loop in
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Parent as Parent Component
participant InputSelect as InputSelect Root
participant Item as InputSelect.Item
participant registerItem as registerItem callback
Note over Parent,registerItem: Initial Render (PR #6398)
Parent->>InputSelect: Render with items
InputSelect->>Item: Mount Item component
Item->>registerItem: Call with {value, children, icon}
registerItem->>InputSelect: setItems (triggers re-render)
InputSelect->>Item: Re-render Item
Item->>registerItem: Call with NEW icon reference
Note over registerItem: Icon created via createIcon() has<br/>unstable reference on each render
registerItem->>InputSelect: setItems (triggers re-render)
Note over InputSelect,registerItem: ⚠️ INFINITE LOOP
Note over Parent,registerItem: After This Fix (PR #6402)
Parent->>InputSelect: Render with items
InputSelect->>Item: Mount Item component
Item->>registerItem: Call with {value, children, icon}
Note over registerItem: Check: prev.has(item.value)?
registerItem->>InputSelect: setItems (triggers re-render)
InputSelect->>Item: Re-render Item
Item->>registerItem: Call with NEW icon reference
Note over registerItem: Check: prev.has(item.value)?<br/>✓ Already registered, return prev
Note over registerItem: No state update = No re-render
Note over InputSelect,registerItem: ✅ Loop prevented
|
|
@cubic-dev-ai, could you please review this? Thanks! |
@raunakab I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="web/src/refresh-components/inputs/InputSelect.tsx">
<violation number="1" location="web/src/refresh-components/inputs/InputSelect.tsx:173">
The early-return guard never triggers because `registerItem` is only invoked after its cleanup has already removed the previous entry, so the infinite re-register/unregister loop still occurs when `children` has an unstable reference. The hotfix does not fix the reported issue.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
@cubic-dev-ai, please re-review this again. |
@raunakab I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="web/src/refresh-components/inputs/InputSelect.tsx">
<violation number="1" location="web/src/refresh-components/inputs/InputSelect.tsx:406">
Removing children/icon from the effect dependencies means the selected-item registry never updates when those props change, so the trigger can show stale labels/icons for items whose content updates after mount.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
@cubic-dev-ai, please review this one again! |
@raunakab I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="web/src/refresh-components/inputs/InputSelect.tsx">
<violation number="1" location="web/src/refresh-components/inputs/InputSelect.tsx:253">
Selected option label/icon stay stuck if those props change because `displayContent` only depends on the selectedItemDisplay object, so the trigger never re-renders with the updated ref contents.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
@cubic-dev-ai, please review this one again! |
@raunakab I've started the AI code review. It'll take a few minutes to complete. |
Description
Hotfix for infinite loop issue for
InputSelect.Summary by cubic
Fixes an infinite re-render loop in InputSelect by registering only the selected item's display via refs. Also resolves controlled/uncontrolled non-persistence and prevents UI freezes with unstable children.
Written for commit 9d81733. Summary will update automatically on new commits.