-
-
Notifications
You must be signed in to change notification settings - Fork 53
eslint fixes #1225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eslint fixes #1225
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis change removes unused imports and variables, and adjusts some default prop values across multiple React component and primitive files. The updates are focused on code cleanup, primarily eliminating unused hooks, context properties, and utility imports, as well as standardizing default prop values in a radio group component. Changes
Sequence Diagram(s)No sequence diagram generated, as the changes are limited to code cleanup and default value adjustments without affecting control flow or introducing new features. Estimated code review effort1 (~5 minutes) Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (4)
src/components/ui/Tree/fragments/TreeItem.tsx (1)
8-13: Add explicit typings foritemandlevelprops
itemis referenced later (item.items,item.label) but isn’t part of the declared prop type, forcing callers to fall back toanyand undermining type safety.type TreeItemProps = { children: React.ReactNode; - [key: string]: any; + item: { + label: string; + items?: TreeItemProps['item'][]; + }; + level?: number; + className?: string; + [key: string]: any; // keep index signature if truly needed };src/components/ui/Link/Link.tsx (2)
10-17:propstype is incorrect – should not be an array.
props?: Record<string, any>[];implies you expect an array of props, but you later spread...props(an object). Change the type to a single object to satisfy TS and avoid the@ts-ignorefurther down.- props?: Record<string, any>[]; + props?: Record<string, any>;
22-27: Remove the@ts-ignoreby aligning types & drop misleading TODO.
- Once the props type is fixed, the ignore directive can be deleted.
- The TODO about an
altattribute on<a>is obsolete—please delete it to avoid confusion.- // @ts-ignore - return <Primitive.a href={href} className={clsx(rootClass, className)} {...dataAttributes()} {...props}>{children}</Primitive.a>; + return ( + <Primitive.a + href={href} + className={clsx(rootClass, className)} + {...dataAttributes()} + {...props} + > + {children} + </Primitive.a> + );src/core/primitives/Select/fragments/SelectPrimitiveContent.tsx (1)
37-44: Guard againstrefs.floating.currentbeing null before dereferencing
querySelectorwill throw ifrefs.floating.currentis stillnull(which can happen while focus manager is mounting / unmounting).
Add a null check so the handler is resilient.- onKeyDownCapture={(e) => { - if (e.key === 'Enter') { - e.preventDefault(); - const itemValue = refs.floating.current.querySelector('[data-active="true"]'); - - if (itemValue) { - handleSelect((itemValue.getAttribute('data-value'))); - } - } - }} + onKeyDownCapture={(e) => { + if (e.key === 'Enter' && refs.floating.current) { + e.preventDefault(); + const itemValue = + refs.floating.current.querySelector('[data-active="true"]'); + + if (itemValue) { + handleSelect(itemValue.getAttribute('data-value')); + } + } + }}
🧹 Nitpick comments (9)
src/core/primitives/Collapsible/contexts/CollapsiblePrimitiveContext.tsx (1)
38-38: Optional: add a displayName for easier React DevTools debugging
Assigning adisplayNameto the context greatly improves traceability when inspecting component trees.-export const CollapsiblePrimitiveContext = createContext<CollapsiblePrimitiveContextValue | undefined>(undefined); +export const CollapsiblePrimitiveContext = + createContext<CollapsiblePrimitiveContextValue | undefined>(undefined); +CollapsiblePrimitiveContext.displayName = 'CollapsiblePrimitiveContext';src/core/utils/RovingFocusGroup/fragments/RovingFocusItem.tsx (1)
58-63: DropfocusedItemIdfrom theuseEffectdeps to avoid redundant executions
focusedItemIdisn’t referenced inside this effect body, yet its presence in the dependency array causes the effect to re-run every time focus changes, wasting cycles.- }, [focusItems, focusedItemId, id, addFocusItem]); + }, [focusItems, id, addFocusItem]);src/components/ui/Slider/fragments/SliderThumb.tsx (1)
16-17: Remove strayconsole.logbefore shippingLeaving debug statements in production components clutters the console and can leak internal state.
- console.log(e.target.value); + // handle value change heresrc/core/primitives/Select/fragments/SelectPrimitiveRoot.tsx (1)
64-73:useLayoutEffectdeps reference.currentfields – causes perpetual re-runsObjects like
refs.floating.currentandselectedItemRef.currentare mutated outside React’s state system, so their identity changes every render, re-triggering the effect unnecessarily.-}, [refs.floating.current, selectedItemRef.current, shift, isOpen]); +// depend only on stable refs / state +}, [shift, isOpen, refs.floating, selectedItemRef]);Alternatively, compute the measurements inside the effect without listing the volatile
.currentvalues as dependencies.src/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveRoot.tsx (1)
28-33: Nit: consider narrowing context value type.
sendItemsis implicitlyanyunlessRadioGroupContextis typed. Add an explicit interface so downstream consumers get autocomplete & type-safety.src/components/ui/AvatarGroup/AvatarGroup.tsx (1)
11-16: Whitespace fix is fine, but logging in production is not.
console.warnat line 7 will fire every render – noisy for consumers. Replace with dev-only invariant or remove entirely.src/components/ui/Select/fragments/SelectPortal.tsx (1)
9-13:rootElementis dead code and can be removed.
It’s computed but never used, still flagged by eslint. Drop it or pass it toSelectPrimitive.Portalif that was the intent.- const rootElement = document.querySelector('#rad-ui-theme-container') || document.body as HTMLElement | null;src/components/ui/Select/fragments/SelectRoot.tsx (1)
1-1: Import is fine – optional further cleanupSince the file no longer references
React, you could also drop the default import altogether if the project uses the automatic JSX runtime ("jsx": "react-jsx"intsconfig.json).src/core/primitives/Select/fragments/SelectPrimitiveSearch.tsx (1)
57-58: Drop leftover console logs
console.logcalls will slip into production bundles and defeat the eslint goal of this PR.- console.log('arrow input taken'); ... - console.log('activeItemValue', activeItemValue);Also applies to: 81-82
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (27)
src/components/ui/Accordion/fragments/AccordionRoot.tsx(1 hunks)src/components/ui/AlertDialog/fragments/AlertDialogTrigger.tsx(0 hunks)src/components/ui/AvatarGroup/AvatarGroup.tsx(1 hunks)src/components/ui/AvatarGroup/fragments/AvatarGroupItem.tsx(1 hunks)src/components/ui/Link/Link.tsx(1 hunks)src/components/ui/RadioGroup/fragments/RadioGroupRoot.tsx(0 hunks)src/components/ui/Select/fragments/SelectContent.tsx(1 hunks)src/components/ui/Select/fragments/SelectPortal.tsx(1 hunks)src/components/ui/Select/fragments/SelectRoot.tsx(1 hunks)src/components/ui/Slider/fragments/SliderThumb.tsx(1 hunks)src/components/ui/Slider/fragments/SliderTrack.tsx(1 hunks)src/components/ui/Switch/fragments/SwitchRoot.tsx(1 hunks)src/components/ui/Switch/fragments/SwitchThumb.tsx(1 hunks)src/components/ui/Tooltip/fragments/TooltipTrigger.tsx(1 hunks)src/components/ui/Tree/fragments/TreeItem.tsx(1 hunks)src/core/primitives/Avatar/fragments/AvatarPrimitiveFallback.tsx(1 hunks)src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveRoot.tsx(1 hunks)src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx(0 hunks)src/core/primitives/Collapsible/contexts/CollapsiblePrimitiveContext.tsx(1 hunks)src/core/primitives/Dialog/fragments/DialogPrimitiveContent.tsx(0 hunks)src/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveRoot.tsx(2 hunks)src/core/primitives/Select/fragments/SelectPrimitiveContent.tsx(2 hunks)src/core/primitives/Select/fragments/SelectPrimitiveOverlay.tsx(0 hunks)src/core/primitives/Select/fragments/SelectPrimitiveRoot.tsx(1 hunks)src/core/primitives/Select/fragments/SelectPrimitiveSearch.tsx(1 hunks)src/core/primitives/Select/fragments/SelectPrimitiveTrigger.tsx(0 hunks)src/core/utils/RovingFocusGroup/fragments/RovingFocusItem.tsx(1 hunks)
💤 Files with no reviewable changes (6)
- src/core/primitives/Select/fragments/SelectPrimitiveTrigger.tsx
- src/components/ui/RadioGroup/fragments/RadioGroupRoot.tsx
- src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx
- src/components/ui/AlertDialog/fragments/AlertDialogTrigger.tsx
- src/core/primitives/Select/fragments/SelectPrimitiveOverlay.tsx
- src/core/primitives/Dialog/fragments/DialogPrimitiveContent.tsx
🧰 Additional context used
🧠 Learnings (21)
📓 Common learnings
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.
src/components/ui/Slider/fragments/SliderThumb.tsx (3)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/core/utils/RovingFocusGroup/fragments/RovingFocusItem.tsx (3)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/AvatarGroup/fragments/AvatarGroupItem.tsx (1)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
src/components/ui/AvatarGroup/AvatarGroup.tsx (1)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
src/core/primitives/Select/fragments/SelectPrimitiveRoot.tsx (2)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/Link/Link.tsx (2)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
src/components/ui/Select/fragments/SelectPortal.tsx (2)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/Accordion/fragments/AccordionRoot.tsx (3)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like value, defaultValue, and onValueChange. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.
src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveRoot.tsx (4)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like value, defaultValue, and onValueChange. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.
src/core/primitives/Collapsible/contexts/CollapsiblePrimitiveContext.tsx (3)
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like value, defaultValue, and onValueChange. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.
src/core/primitives/Avatar/fragments/AvatarPrimitiveFallback.tsx (1)
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/Select/fragments/SelectContent.tsx (1)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
src/components/ui/Switch/fragments/SwitchRoot.tsx (4)
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.tsx:0-0
Timestamp: 2024-12-12T08:22:59.375Z
Learning: The Dropdown.Trigger component is customizable and needs to be used with Dropdown.Root.
src/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveRoot.tsx (3)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: kotAPI
PR: #1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like value, defaultValue, and onValueChange. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.
src/components/ui/Select/fragments/SelectRoot.tsx (3)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/Tree/fragments/TreeItem.tsx (3)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/core/primitives/Select/fragments/SelectPrimitiveContent.tsx (2)
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
src/components/ui/Switch/fragments/SwitchThumb.tsx (3)
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
src/components/ui/Tooltip/fragments/TooltipTrigger.tsx (4)
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the Dropdown.Trigger component in src/components/ui/Dropdown/Dropdown.stories.tsx.
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
Learnt from: decipher-cs
PR: #417
File: src/components/ui/Dropdown/Dropdown.tsx:0-0
Timestamp: 2024-12-12T08:22:59.375Z
Learning: The Dropdown.Trigger component is customizable and needs to be used with Dropdown.Root.
src/core/primitives/Select/fragments/SelectPrimitiveSearch.tsx (2)
Learnt from: kotAPI
PR: #576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the TogglePrimitive component (src/core/primitives/Toggle/index.tsx), when the component becomes controlled, it's acceptable to not sync the internal isPressed state with the external pressed prop.
Learnt from: GoldGroove06
PR: #1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.143Z
Learning: In the CheckboxGroupPrimitiveTrigger component (src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array [] is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local isChecked changes back to the group's checkedValues. This pattern prevents infinite loops while maintaining proper synchronization.
🧬 Code Graph Analysis (5)
src/core/primitives/Avatar/fragments/AvatarPrimitiveFallback.tsx (1)
src/core/primitives/Avatar/contexts/AvatarPrimitiveContext.tsx (1)
AvatarPrimitiveContext(10-10)
src/core/primitives/Select/fragments/SelectPrimitiveContent.tsx (1)
src/core/primitives/Select/contexts/SelectPrimitiveContext.tsx (1)
SelectPrimitiveContext(26-26)
src/components/ui/Switch/fragments/SwitchThumb.tsx (1)
src/components/ui/Switch/context/SwitchContext.tsx (1)
SwitchContext(9-13)
src/core/primitives/Select/fragments/SelectPrimitiveSearch.tsx (1)
src/core/primitives/Select/contexts/SelectPrimitiveContext.tsx (1)
SelectPrimitiveContext(26-26)
src/components/ui/Slider/fragments/SliderTrack.tsx (1)
src/components/ui/Slider/context/SliderContext.tsx (1)
SliderContext(13-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (18)
src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveRoot.tsx (1)
26-26: Whitespace cleanup only – LGTMNo functional impact; aligns with eslint clean-up objectives.
src/core/primitives/Avatar/fragments/AvatarPrimitiveFallback.tsx (1)
12-14: Unused context value removed – LGTMThe removal of
hasErrorfrom the destructuring cleanly eliminates an unused variable, silencing the eslint warning without affecting runtime behavior.src/core/primitives/Collapsible/contexts/CollapsiblePrimitiveContext.tsx (1)
1-1: Import clean-up aligns with the repo’s eslint rules – looks good
Removing the default React import eliminates an unused symbol and matches thereact/jsx-runtimesetup the rest of the codebase uses.src/core/utils/RovingFocusGroup/fragments/RovingFocusItem.tsx (1)
1-1: UnuseduseRefimport successfully removedThe import list now reflects the actual hooks used in this file, eliminating a previously-reported eslint
no-unused-varserror.src/components/ui/Slider/fragments/SliderThumb.tsx (1)
3-3: Import cleanup looks goodRemoving the unused named import keeps the module eslint-clean without impacting functionality.
src/components/ui/Tree/fragments/TreeItem.tsx (1)
1-1: Unused hook removed — import list now accurateNo further action required.
src/core/primitives/Select/fragments/SelectPrimitiveRoot.tsx (1)
2-2: Removed unuseduseEffectimport – good cleanupThis resolves an eslint warning without altering behavior.
src/components/ui/Accordion/fragments/AccordionRoot.tsx (1)
2-2: UnuseduseStateimport removed – eslint error resolvedImport list now mirrors actual usage.
src/components/ui/Link/Link.tsx (1)
5-5: Unused hook successfully removed.
Import list is now minimal and eslint-clean.src/core/primitives/RadioGroup/fragments/RadioGroupPrimitiveRoot.tsx (1)
1-1: Good cleanup.
Removing the unuseduseStatekeeps imports lean.src/components/ui/Tooltip/fragments/TooltipTrigger.tsx (1)
14-15: Confirm no other components rely on the removed context fields.
setIsOpen&datawere dropped from destructuring. If sibling components still expect them, you’ll get runtime errors. Quick grep recommended before merge.src/components/ui/Select/fragments/SelectContent.tsx (1)
2-2: Good cleanupImport list now matches actual usage – keeps bundle lean.
src/components/ui/AvatarGroup/fragments/AvatarGroupItem.tsx (1)
8-10: Whitespace only – looks goodsrc/components/ui/Switch/fragments/SwitchRoot.tsx (1)
19-19: Minor style change OKFormatting reads better and keeps eslint happy. No further action.
src/core/primitives/Select/fragments/SelectPrimitiveSearch.tsx (1)
8-9: Removal of unusedselectedItemRefis correctThat property is not referenced anywhere in this component, so dropping it cleans up the context pull and avoids eslint-unused-vars noise.
src/components/ui/Slider/fragments/SliderTrack.tsx (1)
6-9: Removal ofsetValuelooks good
setValuewas never referenced in this component, so trimming the context destructuring is the correct eslint-driven fix.
No functional impact. 👍src/core/primitives/Select/fragments/SelectPrimitiveContent.tsx (1)
12-12: Unused imports successfully eliminated
useEffectandPrimitivewere indeed unused.
Nice clean-up that silences the linter with zero behavioural change.src/components/ui/Switch/fragments/SwitchThumb.tsx (1)
8-10: Context destructuring trimmed correctly
setCheckedisn’t used insideSwitchThumb, so its removal reduces eslint noise without side-effects.
Component behaviour is unchanged.
closes #1185
errors brought down from 54 to 25
Summary by CodeRabbit
No changes to user-facing features or functionality.