Skip to content

Commit

Permalink
Handle null default value
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Oct 14, 2024
1 parent 93c64a1 commit 1ef2828
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mui-base/src/Select/Root/useSelectRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export function useSelectRoot(params: useSelectRoot.Parameters): useSelectRoot.R
useEnhancedEffect(() => {
// Wait for the items to have registered their values in `valuesRef`.
queueMicrotask(() => {
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
const stringValue =
typeof value === 'string' || value === null ? value : JSON.stringify(value);
const index = valuesRef.current.indexOf(stringValue);
if (index !== -1) {
setSelectedIndex(index);
Expand Down

0 comments on commit 1ef2828

Please sign in to comment.