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

Plots pane doesn't show thumbnails after a reload #397

Open
jmcphers opened this issue Apr 10, 2023 · 1 comment
Open

Plots pane doesn't show thumbnails after a reload #397

jmcphers opened this issue Apr 10, 2023 · 1 comment
Labels
area: plots Issues related to Plots category. bug Something isn't working theme: app builder

Comments

@jmcphers
Copy link
Collaborator

To reproduce:

  1. Start R
  2. Create a few plots (say, 4)
  3. Reload the UI or browser

This is the result:

image

We do correctly re-introduce each plot to the UI after a reload, but we lose the thumbnail in the history filmstrip; it just shows a blank square.

Not necessary for Alpha since that is desktop-only and reloading won't be too common there, but needs to be fixed for acceptable behavior in browser-based versions of Positron.

@jmcphers jmcphers added this to the Internal Preview milestone Apr 10, 2023
@jmcphers
Copy link
Collaborator Author

The reason this happens is that there isn't currently such a thing as a thumbnail; we literally use the same image that was initially rendered -- so the only way to get a thumbnail is to generate a full-size image. Generating images can be very expensive, so we don't want to demand that the language runtime churn out a half-dozen or more of them at the same time we are reconnecting and trying to hook up the rest of the UI.

@petetronic pointed out that one way to fix this might be to imitate what we did for the Help pane: have the plots served at an HTTP endpoint, and set the browser headers such that the browser itself could cache the plots and therefore the thumbnails.

Another approach would be to effectively use a screen-capture to copy the plot thumbnail and save the data as base64 encoded PNG in VS Code's storage service. We could do this by drawing the image into a canvas and using toDataURL: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: plots Issues related to Plots category. bug Something isn't working theme: app builder
Projects
None yet
Development

No branches or pull requests

7 participants