Skip to content

Commit

Permalink
Refactor useSlot function to dynamically determine elementType
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Feb 6, 2024
1 parent 59addf0 commit da9eb42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mui-material/src/utils/useSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ export default function useSlot<
...other
} = externalForwardedProps;

const elementType = slots[name] || initialElementType;

// `slotProps[name]` can be a callback that receives the component's ownerState.
// `resolvedComponentsProps` is always a plain object.
const resolvedComponentsProps = resolveComponentProps(slotProps[name], ownerState);

const elementType = slots[name] || resolvedComponentsProps?.component || initialElementType;

const {
props: { component: slotComponent, ...mergedProps },
internalRef,
Expand Down

0 comments on commit da9eb42

Please sign in to comment.