jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

Naive update infinite loop #95

Closed jasongrout closed 7 years ago

jasongrout commented 7 years ago

The new ipywidgets _view_count mechanism combined with the very naive update function in things like SurfaceView (https://github.com/jovyan/pythreejs/blob/bc60487d95e98f25c163eed65509da72f2dfd997/js/src/jupyter-threejs.js#L574) I think creates an infinite loop, where creating a view updates the model's view count, which then creates a new view, etc.

Clearly pythreejs needs to be smarter about updates, but I also wonder how common this might be, and how much having an automatic _view_count trip people up.

CC @maartenbreddels, @SylvainCorlay.

maartenbreddels commented 7 years ago

I very much depend on _view_count, so I obviously want to keep it in. What about a _record_view_count property which defaults to False, so it only works when you set it to True? And looking at the bright side, it does expose a possible bug ;)

jasongrout commented 7 years ago

And looking at the bright side, it does expose a possible bug ;)

yes, that's what I'm tracking down now.

jasongrout commented 7 years ago

This is fixed in the latest alpha of ipywidgets - basically we don't call the widget update when just the _view_count changes.