You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi - would like to suggest adding some detail in the documentation relating to widget variable name collisions.
Using certain widget variables can cause errors. In my case, I used 'style', which returned the following error from DOMWidgetView:
Uncaught (in promise) TypeError: Cannot read property 'then' of undefined
at l.t.create_view (manager-base.js:85)
at EmailView.e.create_child_view (widget.js:604)
at widget.js:774
Looking into the widget.tsfile, it does show that the 'style' variable is already used there for DOMWidgetView.
Steps I took to get this error message:
Followed the Custom Widget tutorial, but replaced every occurrence of the value variable with style instead.
In Jupyter Notebook, instantiated the widget using email = Email(value='john.doe@domain.com', disabled=False) and email
F12 to see the error in console
It didn't seem to affect functionality.
Suggested Improvement
One solution might be to add into the documentation a list of some variables to avoid using because of potential collisions.
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up @jasonho-lynx - I think adding more docs for this is great idea. Would you like to make a PR? It could either go into the existing tutorial or into a new page that would have miscellaneous information for making a custom widget.
We could also consider changing the name like we did in #2944 and #3122
Link: https://github.com/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20Custom.ipynb
Problem
Hi - would like to suggest adding some detail in the documentation relating to widget variable name collisions.
Using certain widget variables can cause errors. In my case, I used 'style', which returned the following error from
DOMWidgetView
:Looking into the
widget.ts
file, it does show that the 'style' variable is already used there forDOMWidgetView
.Steps I took to get this error message:
value
variable withstyle
instead.email = Email(value='john.doe@domain.com', disabled=False)
andemail
It didn't seem to affect functionality.
Suggested Improvement
One solution might be to add into the documentation a list of some variables to avoid using because of potential collisions.
The text was updated successfully, but these errors were encountered: