Skip to content

Commit

Permalink
Update message and params again
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Nov 25, 2023
1 parent 290db4d commit 9370c8b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/mui-base/src/Select/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ describe('<Select />', () => {
expect(() => {
setProps({ value: undefined });
}).toErrorDev(
'useControllableReducer: The useSelect component is changing a controlled prop to be uncontrolled: selectedValues',
'useControllableReducer: The Select component is changing a controlled prop to be uncontrolled: selectedValues',
);
});

Expand All @@ -1380,7 +1380,7 @@ describe('<Select />', () => {
expect(() => {
setProps({ value: 1 });
}).toErrorDev(
'useControllableReducer: The useSelect component is changing an uncontrolled prop to be controlled: selectedValues',
'useControllableReducer: The Select component is changing an uncontrolled prop to be controlled: selectedValues',
);
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/mui-base/src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const Select = React.forwardRef(function Select<
onOpenChange: onListboxOpenChange,
getOptionAsString,
value: valueProp,
componentName: 'Select',
});

const ownerState: SelectOwnerState<OptionValue, Multiple> = {
Expand Down
3 changes: 2 additions & 1 deletion packages/mui-base/src/useSelect/useSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function useSelect<OptionValue, Multiple extends boolean = false>(
getOptionAsString = defaultOptionStringifier,
getSerializedValue = defaultFormValueProvider,
value: valueProp,
componentName = 'useSelect',
} = props;

const buttonRef = React.useRef<HTMLElement>(null);
Expand Down Expand Up @@ -287,7 +288,7 @@ function useSelect<OptionValue, Multiple extends boolean = false>(
getItemAsString: stringifyOption,
selectionMode: multiple ? 'multiple' : 'single',
stateReducer: selectReducer,
componentName: 'useSelect',
componentName,
};

const {
Expand Down
6 changes: 6 additions & 0 deletions packages/mui-base/src/useSelect/useSelect.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export interface UseSelectParameters<OptionValue, Multiple extends boolean = fal
* Set to `null` to deselect all options.
*/
value?: SelectValue<OptionValue, Multiple>;
/**
* The name of the component using useSelect.
* For debugging purposes.
* @default 'useSelect'
*/
componentName?: string;
}

interface UseSelectButtonSlotEventHandlers {
Expand Down

0 comments on commit 9370c8b

Please sign in to comment.