Skip to content

Add plot thumbnail cache feature so plots pane shows thumbnails after a reload #7752

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

softwarenerd
Copy link
Contributor

@softwarenerd softwarenerd commented May 17, 2025

Description

This PR addresses #397 by adding a thumbnail cache feature to plots. Now, when Positron is reloaded, the Plots pane will show thumbnails for all the current plots.

Here's a screen recording of this in action:

Screen.Recording.2025-05-16.at.7.02.52.PM.mov

Tests:
@:plots

Release Notes

New Features

  • N/A

Bug Fixes

QA Notes

Please note that #7584 has not been addressed yet. It is a separate bug unrelated to this PR.

Copy link

github-actions bot commented May 17, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:plots

readme  valid tags

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a thumbnail cache feature so that the plots pane can restore thumbnails after a reload.

  • Introduce getCachedPlotThumbnailURI in the service interface and stub in tests
  • Implement storage, retrieval, and cleanup of cached thumbnail descriptors in PositronPlotsService
  • Update thumbnail components to initialize from cache before the plot renders again

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vs/workbench/services/positronPlots/test/common/testPositronPlotsService.ts Added stub getCachedPlotThumbnailURI to the test service
src/vs/workbench/services/positronPlots/common/positronPlots.ts Added getCachedPlotThumbnailURI to the public service interface
src/vs/workbench/contrib/positronPlots/browser/positronPlotsService.ts Implemented caching logic: store on save, load on init, and provide retrieval method
src/vs/workbench/contrib/positronPlots/browser/components/webviewPlotThumbnail.tsx Updated WebviewPlotThumbnail to initialize from cache and subscribe/unsubscribe correctly
src/vs/workbench/contrib/positronPlots/browser/components/dynamicPlotThumbnail.tsx Updated DynamicPlotThumbnail to initialize from cache (needs cleanup for its listener)
Comments suppressed due to low confidence (2)

src/vs/workbench/services/positronPlots/test/common/testPositronPlotsService.ts:216

  • Add unit tests to verify that thumbnail URIs are correctly stored to and retrieved from the cache, including edge cases with missing or invalid entries.
getCachedPlotThumbnailURI(plotId: string) {

src/vs/workbench/contrib/positronPlots/browser/positronPlotsService.ts:96

  • [nitpick] Rename thumbnailURI to thumbnailUri to match camelCase conventions used elsewhere (e.g., plotClient.thumbnailUri).
readonly thumbnailURI: string;

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

Successfully merging this pull request may close these issues.

1 participant