Giter Site home page Giter Site logo

Comments (17)

garronej avatar garronej commented on July 20, 2024 1

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.

chazsolo avatar chazsolo commented on July 20, 2024 1

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.

garronej avatar garronej commented on July 20, 2024 1

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.

chazsolo avatar chazsolo commented on July 20, 2024 1

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.

garronej avatar garronej commented on July 20, 2024 1

image

from tss-react.

garronej avatar garronej commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

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.

chazsolo avatar chazsolo commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

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

garronej avatar garronej commented on July 20, 2024

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.

chazsolo avatar chazsolo commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

Let's go! Glad it worked!

from tss-react.

netzwerg avatar netzwerg commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

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.

image

from tss-react.

netzwerg avatar netzwerg commented on July 20, 2024

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.

garronej avatar garronej commented on July 20, 2024

Thanks for reporting

from tss-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.