Comments (17)
Hi,
Thanks you for the kind words and the comprehensive description of your issue.
Trust that I will have a look promptly.
from tss-react.
I will be able to check to see if all this works on Tuesday - I'll let you know how it goes!
from tss-react.
I'd love to send you something but as I said it's all on a different system, I have to type out what we have by hand.
Damn man, I feel you.
Don't forget to update this:
- import createCache from 'tss-react/@emotion/cache';
+ import createCache from "@emotion/cache";
- "@emotion/cache": "^11.4.0", #You don't need that.
"@emotion/react": "^11.4.1",
-"@emotion/styled": "^10.0.27",
+"@emotion/styled": "^11.3.0",
"@mui/material": "^5.0.2",
- "tss-react": "^0.9.4",
+ "tss-react": "^1.0.0",
I think it's the outdated @emotion/styled
that is the source of the problem.
from tss-react.
I think it's the outdated @emotion/styled that is the source of the problem.
You were spot on - this fixed it!
from tss-react.
from tss-react.
Your problem is due to the fact that, in your workspace, @mui/material
and tss-react
aren't using the same instance of @emotion/cache
.
I'll get back to you
from tss-react.
Everything should work in v0.9.4. Update @mui/material
, tss-react
, @emotion/react
and @emotion/styled
to the latest version in your package.json
, remove your .yarn.lock
file and reinstall.
Sorry you had to go through this.
from tss-react.
Just one last thing, I'd suggest you this change in your configuration:
import { useTheme } from '@mui/material/styles';
-import theme from '$src/theme';
+import type theme from '$src/theme';
-function useTheme() { return theme; }
-export const { makeStyles, useStyles } = createMakeStyles({ useTheme });
+export const { makeStyles, useStyles } = createMakeStyles({ "useTheme": useTheme as (()=> typeof theme) });
It's better as you might want, in the future, implement a dark mode or something like that. The useTheme
hook is supposed to pick up the contextual theme
object that you provided using <ThemeProvider />
I have updated the documentation regarding this aspect as you are not the first one my documentation confused.
from tss-react.
Unfortunately this did not work for us - after making the updates the order of CSS injection is still backwards with tss-
classes being overwritten.
I'm still curious as to what the cache creation is really doing as I commented above in my code - even though I'm creating a new cache with the key of mui
that doesn't seem to make any effect. Whether I include the cache or not everything remains the same.
from tss-react.
😮
I'm sorry you still have problems.
Your problem is due to the fact that tss-react
and @mui/material
are using different versions of @emotion/cache
.
Have you tried updating @emotion/react
, @emotion/styled
, @mui/material
, tss-react
in your package.json
, deleting you .yarn.lock
or package-lock.json
file and reinstalling everything?
What package manager are you using?
@emotion/cache
is a dependency of @emotion/react
that is, itself, a peer-dependency of both @mui/material
and tss-react
.
from tss-react.
If you repo is open-source I can fix it directly. Otherwise will you send me your yarn.lock
file (after re-installing everything).
from tss-react.
We're using npm
. I'd love to send you something but as I said it's all on a different system, I have to type out what we have by hand.
I did remove our lock file and reinstall everything, ensuring those packages are up-to-date. I will do some more investigation and let you know if I can't figure it out.
Here's the packages/versions we're running:
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^10.0.27",
"@mui/material": "^5.0.2",
"tss-react": "^0.9.4",
from tss-react.
Let's go! Glad it worked!
from tss-react.
First things first: Thanks for tss-react – long live makeStyles! 🎉
I've just spent more than an hour figuring out that @emotion/styled
is a required dependency – where would be the best place to document this more prominently?
from tss-react.
Hi @netzwerg,
Sorry you had to go through this. Been there, very frustrating. I added a warning in the setup page but apparently it's not enough, I will edit.
from tss-react.
I copied the yarn add
line, so this totally would have saved me (the warning was too far down 🙈) – thanks a lot! 🎉
from tss-react.
Thanks for reporting
from tss-react.
Related Issues (20)
- How to opt out of RTL transformation? HOT 3
- <GlobalStyles /> don't work properly with next.js app folder HOT 7
- cannot Import multiple makeStyles HOT 1
- Use eslint rule to detect unused classed with imports HOT 2
- React 16.10.0 failed to install @ mui/material HOT 1
- How to use with css and styled apis. HOT 1
- yarn install with pnp mode complains about missing dependency @mui/material HOT 3
- NextJS/MUI/TSS - Cannot read properties of undefined (reading 'classes') HOT 3
- Hard reload after any file change HOT 2
- TssCacheProvider is not working when used with emotion cache and mui 5 HOT 6
- Using with Shadowed Web Components HOT 3
- Next.js: Applying augmentDocumentWithEmotionCache to document breaks AMP pages HOT 2
- The right way typing props when using withStyles HOT 3
- Invalid type for withStyles HOT 4
- Mantine integration
- Using `@import` rule within `<GlobalStyles />` component HOT 8
- `GlobalStyles` create multiple <style data-emotion="css-global">...<style> HOT 1
- Cannot read properties of undefined (reading 'length') in useGuaranteedMemo HOT 3
- MUI V5: Performance issues HOT 4
- Prop `className` did not match. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tss-react.