-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Remove warning message in production #13911
Merged
oliviertassinari
merged 1 commit into
mui:master
from
oliviertassinari:bundle-size-warning
Jul 22, 2024
Merged
[core] Remove warning message in production #13911
oliviertassinari
merged 1 commit into
mui:master
from
oliviertassinari:bundle-size-warning
Jul 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploy preview: https://deploy-preview-13911--material-ui-x.netlify.app/ |
oliviertassinari
force-pushed
the
bundle-size-warning
branch
7 times, most recently
from
July 20, 2024 19:26
53b6b31
to
7ef9173
Compare
oliviertassinari
force-pushed
the
bundle-size-warning
branch
from
July 20, 2024 23:02
7ef9173
to
a887c7b
Compare
1 task
romgrk
approved these changes
Jul 21, 2024
1 task
oliviertassinari
added a commit
to mui/material-ui
that referenced
this pull request
Jul 21, 2024
1 task
JCQuintas
approved these changes
Jul 22, 2024
DungTiger
pushed a commit
to DungTiger/mui-x
that referenced
this pull request
Jul 23, 2024
joserodolfofreitas
pushed a commit
to joserodolfofreitas/material-ui
that referenced
this pull request
Jul 29, 2024
6 tasks
thomasmoon
pushed a commit
to thomasmoon/mui-x
that referenced
this pull request
Sep 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same as #12992.
Before
All of these warnings do nothing in production mode, and yet, they are sent to the client:
"the value of a field is an object" https://mui.com/x/react-data-grid/
It was also possible to solve this problem with
const valueError = /*#__PURE__*/ buildWarning(
demo but this seems to be a really painful DX. For example, how do you add tests for the warning DX? You need to rest the warnOnce cache between each test, ouch.After
This seems to save 2kB gzipped comparing https://deploy-preview-13911--material-ui-x.netlify.app/x/react-data-grid/ to https://deploy-preview-13910--material-ui-x.netlify.app/x/react-data-grid/, a good win in absolute terms. Now, 2kB out of 748kB on the page, it's not a big win in relative terms, but why is there so much JavaScript loaded in the first place.
Off-topic. On code infra. In Base UI, Material UI, we have relied on propTypes as much as possible for those warnings because they have the warn once logic built-in and give you the React tree trace. But, we couldn't always do this, we added simple
console.error
/console.warn
. Now, those are missing a "warn once" logic, so I think that eventually, we should move thiswarnOnce()
helper to @base_ui/internals.cc @Janpot @michaldudak
It also relates to #5550 and https://www.notion.so/mui-org/Community-surveys-12055ef9657f44b5a449c9547c96bfcb?pvs=4#c40ab63b5810454193b02ca4b32f6458 around trying to be as lean as possible.
It's also related to developers often saying: "this is over-engineered, I don't want this", e.g. on React Aria. Meaning, I don't want you to support use cases A, B, C, you should have said no to the person who asked.