Skip to content

Conversation

@rivka-ungar
Copy link
Contributor

@rivka-ungar rivka-ungar commented Oct 15, 2025

User description

https://monday.monday.com/boards/3532714909/views/80492480/pulses/18072990259


PR Type

Bug fix


Description

  • Modified index assignment in dropdown options to mutate items directly

  • Added index property to BaseListItemData type definition

  • Changed from spread operator to direct mutation for index tracking


Diagram Walkthrough

flowchart LR
  A["BaseListItemData type"] -- "add index property" --> B["Type definition updated"]
  C["normalizeOptions function"] -- "change index assignment" --> D["Direct mutation instead of spread"]
  D --> E["Correct index tracking"]
Loading

File Walkthrough

Relevant files
Enhancement
BaseListItem.types.ts
Add index property to BaseListItemData type                           

packages/core/src/components/BaseListItem/BaseListItem.types.ts

  • Added optional index property to BaseListItemData type
  • Property documented to track item position in list
+4/-0     
Bug fix
dropdownUtils.ts
Fix index assignment using direct mutation                             

packages/core/src/components/next/Dropdown/utils/dropdownUtils.ts

  • Changed index assignment from spread operator to direct mutation
  • Applied to both grouped and ungrouped options filtering
  • Ensures correct index tracking during option normalization
+8/-2     

@qodo-merge-for-open-source
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Mutation Side Effects

Directly mutating item.index can affect upstream references if the same objects are shared elsewhere (e.g., cached options, memoized data). Verify that callers expect in-place mutation and that immutability assumptions are not broken.

.map(item => {
  item.index = indexCounter++;
  return item;
});
Index Consistency

Ensure indexCounter increments match the final rendered order across both grouped and ungrouped flows, especially when filtering and toggling showSelectedOptions, to prevent mismatches between displayed position and stored index.

.map(item => {
  item.index = indexCounter++;
  return item;
})
Optional Index Type

index is optional; ensure all consumers handle undefined safely and do not assume presence. Consider documenting when it is guaranteed to be set.

/**
 * The index of the item in the list.
 */
index?: number;

@rivka-ungar rivka-ungar enabled auto-merge (squash) October 15, 2025 19:00
@github-actions
Copy link
Contributor

📦 Bundle Size Analysis

✅ No bundle size changes detected.

Unchanged Components
Component Base PR Diff
Accordion 6.35KB 6.35KB 0B ➖
AccordionItem 67.77KB 67.77KB 0B ➖
AlertBanner 72.5KB 72.5KB 0B ➖
AlertBannerButton 19.03KB 19.03KB 0B ➖
AlertBannerLink 15.34KB 15.34KB 0B ➖
AlertBannerText 65.16KB 65.16KB 0B ➖
AttentionBox 74.03KB 74.03KB 0B ➖
AttentionBoxLink 15.22KB 15.22KB 0B ➖
Avatar 68.06KB 68.06KB 0B ➖
AvatarGroup 95.34KB 95.34KB 0B ➖
Badge 43.52KB 43.52KB 0B ➖
Box 9.36KB 9.36KB 0B ➖
BreadcrumbItem 65.8KB 65.8KB 0B ➖
BreadcrumbMenu 69.97KB 69.97KB 0B ➖
BreadcrumbMenuItem 78.71KB 78.71KB 0B ➖
BreadcrumbsBar 5.78KB 5.78KB 0B ➖
Button 18.74KB 18.74KB 0B ➖
ButtonGroup 69.92KB 69.92KB 0B ➖
Checkbox 68.08KB 68.08KB 0B ➖
Chips 76.76KB 76.76KB 0B ➖
Clickable 6.28KB 6.28KB 0B ➖
ColorPicker 75.86KB 75.86KB 0B ➖
ColorPickerContent 75.12KB 75.12KB 0B ➖
Combobox 85.69KB 85.69KB 0B ➖
Counter 42.36KB 42.36KB 0B ➖
DatePicker 134.16KB 134.16KB 0B ➖
Dialog 53.98KB 53.98KB 0B ➖
DialogContentContainer 6.32KB 6.32KB 0B ➖
Divider 5.55KB 5.55KB 0B ➖
Dropdown 125.01KB 125.01KB 0B ➖
menu 59.85KB 59.85KB 0B ➖
option 92.86KB 92.86KB 0B ➖
singleValue 92.71KB 92.71KB 0B ➖
EditableHeading 67.84KB 67.84KB 0B ➖
EditableText 67.75KB 67.75KB 0B ➖
EmptyState 72.4KB 72.4KB 0B ➖
ExpandCollapse 67.59KB 67.59KB 0B ➖
Flex 7.52KB 7.52KB 0B ➖
FormattedNumber 5.87KB 5.87KB 0B ➖
GridKeyboardNavigationContext 4.65KB 4.65KB 0B ➖
Heading 66.46KB 66.46KB 0B ➖
HiddenText 5.43KB 5.43KB 0B ➖
CustomSvgIcon 11.86KB 11.86KB 0B ➖
Icon 13.78KB 13.78KB 0B ➖
IconButton 69.59KB 69.59KB 0B ➖
Info 73.87KB 73.87KB 0B ➖
Label 70.08KB 70.08KB 0B ➖
LayerProvider 2.95KB 2.95KB 0B ➖
LegacyModal 76.28KB 76.28KB 0B ➖
LegacyModalContent 66.55KB 66.55KB 0B ➖
LegacyModalFooter 3.46KB 3.46KB 0B ➖
LegacyModalFooterButtons 20.44KB 20.44KB 0B ➖
LegacyModalHeader 72.56KB 72.56KB 0B ➖
Link 14.97KB 14.97KB 0B ➖
List 74.35KB 74.35KB 0B ➖
ListItem 66.99KB 66.99KB 0B ➖
ListItemAvatar 68.25KB 68.25KB 0B ➖
ListItemIcon 14.13KB 14.13KB 0B ➖
ListTitle 66.59KB 66.59KB 0B ➖
Loader 5.82KB 5.82KB 0B ➖
Menu 8.66KB 8.66KB 0B ➖
MenuDivider 5.65KB 5.65KB 0B ➖
MenuGridItem 7.22KB 7.22KB 0B ➖
MenuItem 78.7KB 78.7KB 0B ➖
MenuItemButton 71.68KB 71.68KB 0B ➖
MenuTitle 66.78KB 66.78KB 0B ➖
MenuButton 67.57KB 67.57KB 0B ➖
MultiStepIndicator 53.05KB 53.05KB 0B ➖
NumberField 74.49KB 74.49KB 0B ➖
LinearProgressBar 7.43KB 7.43KB 0B ➖
RadioButton 67.34KB 67.34KB 0B ➖
Search 72KB 72KB 0B ➖
Skeleton 6.19KB 6.19KB 0B ➖
Slider 75.62KB 75.62KB 0B ➖
SplitButton 68.37KB 68.37KB 0B ➖
SplitButtonMenu 8.81KB 8.81KB 0B ➖
Steps 73.08KB 73.08KB 0B ➖
Table 7.28KB 7.28KB 0B ➖
TableBody 68.25KB 68.25KB 0B ➖
TableCell 66.59KB 66.59KB 0B ➖
TableContainer 5.37KB 5.37KB 0B ➖
TableHeader 5.68KB 5.68KB 0B ➖
TableHeaderCell 73.72KB 73.72KB 0B ➖
TableRow 5.59KB 5.59KB 0B ➖
TableRowMenu 70.25KB 70.25KB 0B ➖
TableVirtualizedBody 72.99KB 72.99KB 0B ➖
Tab 65.22KB 65.22KB 0B ➖
TabList 8.92KB 8.92KB 0B ➖
TabPanel 5.35KB 5.35KB 0B ➖
TabPanels 5.94KB 5.94KB 0B ➖
TabsContext 5.54KB 5.54KB 0B ➖
Text 66.37KB 66.37KB 0B ➖
TextArea 67.69KB 67.69KB 0B ➖
TextField 70.95KB 70.95KB 0B ➖
TextWithHighlight 65.5KB 65.5KB 0B ➖
ThemeProvider 4.69KB 4.69KB 0B ➖
Tipseen 72.89KB 72.89KB 0B ➖
TipseenContent 73.39KB 73.39KB 0B ➖
TipseenImage 73.19KB 73.19KB 0B ➖
TipseenMedia 72.98KB 72.98KB 0B ➖
TipseenWizard 75.65KB 75.65KB 0B ➖
Toast 75.66KB 75.66KB 0B ➖
ToastButton 18.85KB 18.85KB 0B ➖
ToastLink 15.22KB 15.22KB 0B ➖
Toggle 68.08KB 68.08KB 0B ➖
Tooltip 64.43KB 64.43KB 0B ➖
TransitionView 37.68KB 37.68KB 0B ➖
VirtualizedGrid 12.58KB 12.58KB 0B ➖
VirtualizedList 12.36KB 12.36KB 0B ➖

📊 Summary:

  • Total Base Size: 5.12MB
  • Total PR Size: 5.12MB
  • Total Difference: +0B

@rivka-ungar rivka-ungar merged commit 205ad5a into master Oct 16, 2025
17 checks passed
@rivka-ungar rivka-ungar deleted the dropdown-open-on-selected-item-scroll-to-item-18072990259 branch October 16, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants