Notistack: Material-ui Typography deprecation warnings

Created on 1 Nov 2018  路  18Comments  路  Source: iamhosseindhv/notistack

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 |

All 18 comments

Propably something quite similar here:
image

@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.

@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).

@iamhosseindhv I actually am using the new Typography variants.

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.

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

@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.

@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.

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

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.

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

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?

@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 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

Provide codesandbox @pedro-dcc

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 .

Thanks for the update @JakubPetriska

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

james-cordeiro picture james-cordeiro  路  6Comments

lsansaa picture lsansaa  路  7Comments

Gareon picture Gareon  路  3Comments

ksavery picture ksavery  路  3Comments

kubalobo picture kubalobo  路  5Comments