Skip to content

fix(superdeck): release capture resources and prune stale thumbnails - #108

Merged
leoafarias merged 2 commits into
mainfrom
fix/deck-runtime-lifecycle
Sep 8, 2026
Merged

fix(superdeck): release capture resources and prune stale thumbnails#108
leoafarias merged 2 commits into
mainfrom
fix/deck-runtime-lifecycle

Conversation

@leoafarias

@leoafarias leoafarias commented Sep 8, 2026

Copy link
Copy Markdown
Member

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 teardownSlideCaptureService._releaseCaptureTree rebuilds the root adapter without a child so BuildOwner.finalizeTree unmounts the captured widgets and their State.dispose runs. 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.

_imageToUint8List disposes the captured image in a finally, so a failed PNG encode no longer leaks it.

Thumbnail pruningDeckPresentationState prunes obsolete thumbnails from an effect on the slide collection instead of from generateThumbnails. Cleanup now works without warmup and when the deck becomes empty.

Navigation guardgoToSlide carries 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.yml

Tests

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

fvm dart run melos run analyze --no-select         # Dart/DCM clean
fvm dart run melos run contracts:check --no-select # SUCCESS
fvm dart run melos run test --no-select            # 2,148 package tests passed on the combined stack

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.yml and 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.

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.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

@leoafarias
leoafarias merged commit b7bbc5b into main Sep 8, 2026
5 checks passed
@leoafarias
leoafarias deleted the fix/deck-runtime-lifecycle branch September 8, 2026 19:19
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