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

[docs] CodeSandbox demo is throwing an error #31149

Closed
2 tasks done
brauliodiez opened this issue Feb 19, 2022 · 8 comments
Closed
2 tasks done

[docs] CodeSandbox demo is throwing an error #31149

brauliodiez opened this issue Feb 19, 2022 · 8 comments
Labels
docs Improvements or additions to the documentation

Comments

@brauliodiez
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Browsing the official documentation, card section:

https://mui.com/components/cards/

Opening the Complex interaction example official codesandbox (shrimp and chorizo paella):

https://codesandbox.io/s/qf542i?file=/demo.js

The example is not running as expected, instead a TypeScript error is thrown:

Screenshot 2022-02-19 at 20 59 42

TypeError
(0 , $csb___emotion_utils.registerStyles) is not a function

I have tried to refresh to check if it was an issue of codesanbox, but the error persists.

Expected behavior 🤔

It should run the example with no issues and display the card as usual.

Steps to reproduce 🕹

Steps:

  1. Navigate to the react card component official documentation (https://mui.com/components/cards/)
  2. Go down to the complex interaction (shrimp and chorizo paella example)
  3. Click on the codesandbox link (https://codesandbox.io/s/qf542i?file=/demo.js)
  4. Error is displayed, it's strange because the codesandboxes solutions is JavaScript based but we get a TypeScript error.

Context 🔦

Just browsing the official documentation, this could be an issue if somebody just wants to run the example and learn from it (stackblitz demo works)

Your environment 🌎

Official Codesanbox
Google Chrome
@brauliodiez brauliodiez added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 19, 2022
@MyNameIsTakenOMG
Copy link

MyNameIsTakenOMG commented Feb 20, 2022

Same here, and I was checking the snack bar demo, and somehow it just doesn't work today while it worked yesterday😂 Anyway, many thanks to @sscotth for your solution, it worked now after rolling back to v11.6👍

@abhinav-22-tech
Copy link
Contributor

For temporary solution change @emotion/styled: "latest" to @emotion/styled: "v11.6.0".
image

Please check this: https://codesandbox.io/s/buttonappbar-material-demo-forked-fg0tr9?file=/package.json

@SanketRP
Copy link

Dropping @emotion/styled back to v11.6.0 fixes this for me

This really works thanks to you my laptop survived

@prescottbreeden
Copy link

prescottbreeden commented Feb 21, 2022

This didn't work for me:

  "dependencies": {
    ...
    "@emotion/react": "^11.8.1",
    "@emotion/styled": "11.6.0",
    "@mui/material": "^5.4.2",
    ...
{
  "name": "@emotion/styled",
  "version": "11.6.0",
  "description": "styled API for emotion",
  "main": "dist/emotion-styled.cjs.js",
  "module": "dist/emotion-styled.esm.js",
  "types": "types/index.d.ts",
  "license": "MIT",
  ...

tried rolling back emotion/react as well and no luck

update -- problem was chakra provider -- my app is converting to MUI and removing the provider at the top of the dom tree solved it

@danilo-leal danilo-leal changed the title Documentation - React Card Codesandbox official example throwing error: (0 , $csb___emotion_utils.registerStyles) is not a function [docs] Card demo CodeSandbox is throwing an error Feb 21, 2022
@danilo-leal danilo-leal added docs Improvements or additions to the documentation component: card This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 21, 2022
@flaviendelangle
Copy link
Member

flaviendelangle commented Feb 21, 2022

All the Codesandbox of X have the same issue
It's not only limited to the Card

@m4theushw
Copy link
Member

m4theushw commented Feb 21, 2022

I guess we don't have too much to do here, unless temporary downgrading @emotion/styled. Downloading the CodeSandbox and running it locally works. This registerStyles was added in @emotion/utils v1.1.0, but CodeSandbox is still loading v1.0.0. It may get fixed by itself in the following days.

@oliviertassinari oliviertassinari changed the title [docs] Card demo CodeSandbox is throwing an error [docs] CodeSandbox demo is throwing an error Feb 21, 2022
@oliviertassinari oliviertassinari removed the component: card This is the name of the generic UI component, not the React module! label Feb 21, 2022
@oliviertassinari
Copy link
Member

Note that this alternative still works:

Screenshot 2022-02-21 at 16 42 41

I recall seeing another instance of this cache issue with codesandbox in #16979. In our case, it looks like a bug with Codesandbox's cache. Will see codesandbox/codesandbox-client#6484.

@m4theushw
Copy link
Member

It's working again. https://codesandbox.io/s/on9qjr?file=/demo.tsx

I'm closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

9 participants