-
Notifications
You must be signed in to change notification settings - Fork 633
Widget in iframe does not support renderValue calls #1434
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
Comments
Could you please provide a minimal example? |
Im running these widgets in a pretty specific environment, the underlying cause is simple but setting it up is not. Basically the pen is showing the htmlwidget embedded within an iframe. When clicking the button the javascript code tries to update the widget by calling |
Hmm, that codepen doesn't seem like a great idea. That code is relying pretty heavily on code internal to plotly and htmlwidgets. Have you considered an approach like #1441 (comment)? |
Uh oh!
There was an error while loading. Please reload this page.
Running this htmlwidget within an iframe causes some odd behaviour.
When trying to update the widget's data via renderValue from the parent frame I get this error:
(this is because we are trying to deserialize
graphDiv.data
which is undefined)I've tracked this problem down to plotly's
isPlainObject
implementation which checks if the object's prototype isObject.prototype
:https://github.com/plotly/plotly.js/blob/master/src/lib/is_plain_object.js#L25
Because the widget is in an iframe, the parent's
Object.prototype
is different from the iframe'sObject.prototype
.I see there's been discussion on changing this implementation on the plotly repo:
plotly/plotly.js#1405
but there's little momentum. I propose we can fix it within the widget's js by replacing the object's prototype object if we detect that we're running in an iframe
The text was updated successfully, but these errors were encountered: