mui / mui/material-ui

skipSx should update shouldForwardProps

Open
#31,019 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion scope: system
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

The skipSx doesn't work as expected when shouldForwardProp default mechanism is overwritten and does not include 'sx' directly

shouldForwardProp: (prop) => !["isEven"].includes(prop as string),
skipSx: true

This will send sx to the underlying component

Examples 🌈

I made a code sandbox using the latest released material

https://codesandbox.io/s/goofy-phoebe-xc99x

Motivation 🔦

making a custom component that only changes in CSS layer duo to props is a common practice
also, sx seems to be a little bit slow, and skipping it may gain some performance tips

so because we are working mostly with the Mui component and they pass the props to the underling dom node, it makes sense to have it as a core feature of the material


I seared on skipSx tags in the issue list and could not find an open issue, so posted a new one.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and trace the implementation of skipSx together with the default shouldForwardProp behavior. Confirm the fix by checking that sx is not passed to the underlying component when a custom shouldForwardProp omits it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.