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
React error when running component with material-ui in Jupyter #321
Comments
Looks like the same bug as: #307 - I will try running it outside a notebook |
The same issue occurs from just using |
I'm able to reproduce the problem with Jupyter using Binder and created an issue in The fact this still doesn't work with |
Running |
I am still seeing the issue. What do I need to configure in JS side to make it work? Everything works fine as long as I don't use hook functions. The idom libraries I am using: In import idom
import idom_jupyter
!idom restore
!idom install <package name>
------------------------------------
ipylib = idom.Module(<package name>)
@idom.component
def widget():
return ipylib.example()
widget() package.json {
"name": "...",
"version": "0.0.1",
"description": "",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"scripts": {
"build": "microbundle-crl --compress --format modern,cjs",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "..."
},
"author": "",
"license": "ISC",
"bugs": {
"url": "..."
},
"homepage": "...",
"devDependencies": {
"microbundle-crl": "^0.13.11"
},
"dependencies": {
"@blueprintjs/core": "^3.47.0",
"@blueprintjs/popover2": "^0.11.1",
"react": "^17.0.2"
},
"files": [
"dist"
]
} |
@rafaellichen there's an unreleased, but upcoming change to import json
import idom
import idom_jupyter
mui = idom.web.module_from_template("react", "@material-ui/core", fallback="⌛")
Slider = idom.web.export(mui, "Slider")
@idom.component
def ViewSliderEvents():
(event, value), set_data = idom.hooks.use_state((None, 50))
return idom.html.div(
Slider(
{
"color": "primary" if value < 50 else "secondary",
"step": 10,
"min": 0,
"max": 100,
"defaultValue": 50,
"valueLabelDisplay": "auto",
"onChange": lambda event, value: set_data([event, value]),
}
),
idom.html.pre(json.dumps([event, value], indent=2)),
)
ViewSliderEvents() It should look something like: Let me know if you see any issues there. |
Thank you @rmorshea for the help: #321 (comment)
If I upgrade idom to latest version, I see this error in terminal:
|
@rafaellichen these changes are not released yet. You'll need to wait for the next release of |
@rmorshea thanks a lot. will wait for the next release. There is an error in the Binder example: |
@rafaellichen |
Bug description
When I try to create a button with material-ui/core it comes out blank and an error is printed in the console:
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
The link points to 3 possible causes:
To reproduce
Run the following Jupyter cell:
Expected behavior
Expected to see a material-ui button
Additional context
It works fine with the victory example, I see the expected bar chart.
Versions:
The text was updated successfully, but these errors were encountered: