Skip to content

Commit f771f8f

Browse files
committed
fix: only write to labelForValueRef on init
1 parent e92545a commit f771f8f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/select/src/select.web.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ const ItemContext = React.createContext<{
228228
const Item = React.forwardRef<ItemRef, ItemProps>(
229229
({ asChild, closeOnPress = true, label, value, children, ...props }, ref) => {
230230
const { labelForValueRef } = useRootContext();
231-
labelForValueRef.current[value] = label;
231+
if (!(value in labelForValueRef.current)) {
232+
labelForValueRef.current[value] = label;
233+
}
232234
return (
233235
<ItemContext.Provider value={{ itemValue: value, label: label }}>
234236
<Slot.Pressable ref={ref} {...props}>

0 commit comments

Comments
 (0)