fix(superdeck): release capture resources and prune stale thumbnails - #108
Merged
Conversation
Slide capture built a temporary element, render, and focus tree for every capture and never released it. Unmount that subtree and dispose the render objects, the pipeline owner, and the focus manager on success, on the settle limit, and on failure. Dispose the captured image even when PNG encoding fails. Thumbnail cleanup ran only inside thumbnail warmup, so a deck that lost slides or became empty kept obsolete handles. Prune the thumbnail cache from the slide collection itself. Guard overlapping slide transitions with an operation identifier, so an earlier delay cannot clear the state of a later transition.
|
Visit the preview URL for this PR (updated for commit 3d78cea): https://superdeck-dev--pr108-fix-deck-runtime-lif-08719o64.web.app (expires Thu, 08 Oct 2026 19:07:00 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bd68fc230762285849207e7e120aaf87cd4ca2f9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Slide capture built a temporary element, render, and focus tree for every capture and never released it. Thumbnail cleanup ran only inside thumbnail warmup, so a deck that lost slides or became empty kept obsolete handles. Overlapping slide transitions let an earlier timer clear a later transition's state.
This is PR 1 of a three-PR stack. It targets
main.Changes
Capture teardown —
SlideCaptureService._releaseCaptureTreerebuilds the root adapter without a child soBuildOwner.finalizeTreeunmounts the captured widgets and theirState.disposeruns. It then releases the pipeline owner, the render objects the service created, and the focus manager. This runs on success, on the settle limit, and on failure. The focus manager is disposed in a later microtask, because unmounting focus nodes schedules a focus update that must still run against a live manager._imageToUint8Listdisposes the captured image in afinally, so a failed PNG encode no longer leaks it.Thumbnail pruning —
DeckPresentationStateprunes obsolete thumbnails from an effect on the slide collection instead of fromgenerateThumbnails. Cleanup now works without warmup and when the deck becomes empty.Navigation guard —
goToSlidecarries an operation identifier, so only the latest transition may clear the transitioning state.Capture dimensions, concurrency limits, readiness tracking, and timeout behaviour are unchanged.
Stacked CI — test, Linux integration, and Chromium/WebKit jobs now run for PRs targeting any branch, including the upper PRs in this stack. All checkout steps use v4 and workflow shell variables pass actionlint.
Impacted packages
packages/superdeck.github/workflows/test.ymlTests
Eight new regression tests. All eight fail on the pre-change code and pass after it.
test/src/capture/slide_capture_teardown_test.dart— subtree unmounted after a successful capture, after the settle limit, when a captured widget fails to build, and across a sequence of captures.test/src/deck/deck_presentation_state_test.dart— slide removal without warmup, an empty slide collection, an empty warmup list, and a superseded transition.Commands run
Earlier platform validation reported 39/39 macOS integration tests and 10/10 Chromium/WebKit tests. Those suites were not rerun locally for the workflow-only follow-up; fresh CI now runs them for every stack branch. The browser smoke command used Node 22.18.0.
Follow-up verification:
actionlint .github/workflows/test.ymland Dart/DCM analysis passed. New CI runs validate the updated stack.The follow-up also passed code generation,
melos run fix, contract schema checks, and workflow lint, with no generated-file changes.