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

jupyter iframe state: make it work properly #4727

Closed
williamstein opened this issue Jul 4, 2020 · 3 comments
Closed

jupyter iframe state: make it work properly #4727

williamstein opened this issue Jul 4, 2020 · 3 comments

Comments

@williamstein
Copy link
Contributor

williamstein commented Jul 4, 2020

In CoCalc (probably because of react-windowed, even if set with a very large window size!), when you scroll something involving iframe output off the screen, then back on the screen, the iframe is re-rendered. Of course, this resets any state. It would be much better if all iframes for a jupyter notebook were kept in the DOM somehow, so that this re-rendering doesn't happen.

I'm calling this a bug, since it's clearly the intention of Jupyter classic that the iframe state is preserved.

Relevant code: smc-webapp/jupyter/output-messages/iframe.tsx

A good python3 example that uses an iframe and has state (zoom in on part of the plot):

import plotly.graph_objects as go
go.Figure(data=go.Bar(y=[2, 3, 1]))
@williamstein
Copy link
Contributor Author

This is even worse than I thought -- if you add a cell above a cell that is rendered using an iframe, then the iframe cell reloads.

@williamstein
Copy link
Contributor Author

OK, I think the only way to fix this problem is to eliminate use of react-windowed for Jupyter entirely, unfortunately. This is a lot of work since everything related to scrolling has to get ret reimplemented again.

It's ironic that cocalc uses react-windowed all over the place (e.g., in file listings, etc.,) and it works great, but it doesn't 100% solve the problem for Jupyter, which was the original reason I started using react-windowed.

@williamstein williamstein changed the title jupyter iframe state: implement some sort of iframe cache jupyter iframe state: make it work properly Jul 4, 2020
@williamstein
Copy link
Contributor Author

Fixed via a8e078b and adjacent commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant