-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
[withTheme] Fix typography warning #13707
Conversation
…te a default theme they don't receive the console warning.
Not sure how to test... ideas? |
Every component creates a default theme. This is equivalent to disabling deprecation warnings by default. I don't think that's a good idea. Originally the theme only displayed warnings if you modified a deprecated variant. This was changed so that it always warned if you use any mui component without setting typography to v2 to reduce bundle size. Considering all the feedback and changes that were made my takeaway is that users do not appreciate deprecation warnings by default. Since this is also the approach react itself is taking (i.e. opt-in strict mode) I will consider this the next time I introduce a deprecation. I would only wish that we settle on this in the RFC before I start the implementation. It's quite frustrating to think about good deprecation warning message if most of it is reverted without further discussion. |
@eps1lon The blame is on me, I have overlooked the RFC proposal. I'm sorry. I agree with the takeaway, we should only warn for thing people are doing explicitly wrong. No for APIs that will change in the future. I think that this change is going in the right direction. Once we merge this pull request, we will warn when:
|
@jmcpeak Thank you! |
I'm not 100% sure why, but without the fix this simple create-react-app test produced a warning in the console: (I believe because import Adapter from 'enzyme-adapter-react-16';
import Enzyme, { mount } from 'enzyme';
import React from 'react';
import Table from '@material-ui/core/Table';
import TableFooter from '@material-ui/core/TableFooter';
import TablePagination from '@material-ui/core/TablePagination';
import TableRow from '@material-ui/core/TableRow';
Enzyme.configure({ adapter: new Adapter() });
mount(
<Table>
<TableFooter>
<TableRow>
<TablePagination
count={0}
onChangePage={() => {}}
onChangeRowsPerPage={() => {}}
page={0}
rowsPerPage={0}
/>
</TableRow>
</TableFooter>
</Table>
);
it('test', () => expect(true).toBe(true)); |
@jmcpeak What is the error message? We are not warning anymore if you use restyled variants. |
|
Well this PR isn't released yet so this is expected. |
So that where core components create a default theme they don't receive the console warning.
Closes #13657