Skip to content
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

Material-ui Typography deprecation warnings #19

Closed
JakubPetriska opened this issue Nov 1, 2018 · 18 comments
Closed

Material-ui Typography deprecation warnings #19

JakubPetriska opened this issue Nov 1, 2018 · 18 comments

Comments

@JakubPetriska
Copy link

Expected Behavior

No errors should show up.

Current Behavior

Material UI error about using deprecated typography variant is shown.
47221049-be4b1b00-d3b3-11e8-95ea-77847795ff2f

Tech Version
Notistack 0.3.7
React 16.5.1
Material UI 3.2.2
Browser Chrome
@JakubPetriska JakubPetriska changed the title Error message about deprecated typography variants pops up whenever snackbar is shown Error message about deprecated typography variants shows up whenever snackbar is shown Nov 1, 2018
@JakubPetriska JakubPetriska changed the title Error message about deprecated typography variants shows up whenever snackbar is shown Error message about deprecated typography variants pops up whenever snackbar is shown Nov 1, 2018
@kubalobo
Copy link

kubalobo commented Nov 1, 2018

Propably something quite similar here:
image

@iamhosseindhv
Copy link
Owner

@JakubPetriska notistack doesn't use any Typography component; however, material-ui SnackbarContent uses it internally.
Your issue should be fixed by migrating to Typography v2 api. Read the migration note here.

@iamhosseindhv
Copy link
Owner

@kubalobo We used to pass variant=subtitle1 to bypass the warnings regarding internal use of a deprecated variant by material-ui SnackbarContent.

But this will be removed in the next release of notistack, since we can mute the warnings using useNextVariants in theme (see migration notes).

@JakubPetriska
Copy link
Author

@iamhosseindhv I actually am using the new Typography variants.

@iamhosseindhv
Copy link
Owner

Have you tried isolating / commenting out notistack to make sure the warning is comming from notistack? @JakubPetriska

If you think it's a notistack issue, please reproduce the warning and provide a link to codesandbox.

@JakubPetriska
Copy link
Author

Yes I did and it confirmed that notistack is the issue. Ok I will try to reproduce that and post it here.

@JakubPetriska
Copy link
Author

@iamhosseindhv The error can be seen in this codesandbox. It's the minimal notistack usage example from here but I updated the material-ui dependency to version 3.2.2. The same thing happens for material-ui 3.4.0.

@iamhosseindhv
Copy link
Owner

@JakubPetriska Downloaded the sandbox and I don't get any warning.
Run npm ls @material-ui/core -g and check if you have the same version of material-ui installed. (note the -g flag)

I'll have an eye on this issue in case more people complained about it.

@JakubPetriska
Copy link
Author

The error happens in the sandbox. I didn't try to download it. Why is there a -g flag?

@iamhosseindhv
Copy link
Owner

To compare material/notistack versions installed under /usr/local/lib and your working directory.

According to docs, "List packages in the global install prefix instead of in the current project." So I was wondering maybe you have different versions of material/notistack installed globally and your working directory.

What I just said might be irrelevant to the problem though.

@JakubPetriska
Copy link
Author

I don't have either installed globally, which the output of the command you sent confirmed.

@pedro-dcc
Copy link

pedro-dcc commented Nov 18, 2018

This happens to me too and is notistack for sure... Any news on how to fix?
React 16.7.0-alpha.0
MUI 3.3.2
notistack 0.3.7

Since this will be fixed on 0.3.8 when this version will be published?

@iamhosseindhv
Copy link
Owner

iamhosseindhv commented Nov 19, 2018

@pedro-dcc You should not get any warning regarding "Deprecated variants" using current version of notistack, if you have done material-ui migration instructions.

@JakubPetriska The reason minimal example gives us deprecation warnings is that we don't use theme in it. so we can't set Typography.useNextVariant to true. However, I've added the following loc to the minimal example to avoid getting those nasty warnings:

https://github.com/iamhosseindhv/notistack/blob/master/demo/MessageButtons.js#L47

// Avoid material-ui warnings. more info: https://material-ui.com/style/typography/#migration-to-typography-v2
window.__MUI_USE_NEXT_TYPOGRAPHY_VARIANTS__ = true;

@iamhosseindhv iamhosseindhv changed the title Error message about deprecated typography variants pops up whenever snackbar is shown Material-ui Typography deprecation warnings Nov 19, 2018
@pedro-dcc
Copy link

pedro-dcc commented Nov 19, 2018

@iamhosseindhv you are wrong. I'm already setting "useNextVariants" to true and the warning still happened. And shows up when I show some notistack snackbar.
Also, with release from today i get another warning
screenshot 2018-11-19 at 22 20 24

@iamhosseindhv
Copy link
Owner

Provide codesandbox @pedro-dcc

@JakubPetriska
Copy link
Author

The warning being discussed here no longer appears. I upgraded dependencies in the codepen I provided, the changes can be seen here, and it no longer appears in there either. Unless somebody objects I guess we can close this @iamhosseindhv .

@iamhosseindhv
Copy link
Owner

Thanks for the update @JakubPetriska

@pedro-dcc
Copy link

Provide codesandbox @pedro-dcc

Sorry for coming back so late. I was wrong. I have faced this issue only because I had the snackbar provider outside MuiTheme. After put that inside the warning has gone. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants