Repository navigation
fix(export): capture the latest cell outputs at export time - #12255
Merged
Merged
Conversation
kirangadhave
marked this pull request as ready for review
December 3, 2026 01:21
kirangadhave
requested review from
mscolnick and
peter-gy
and
a balanced review from Copilot
December 3, 2026 01:21
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
If a chart’s lazy import is delayed on its first mount, the PNG capture can contain the loading placeholder instead of the chart. The frame is then marked captured, preventing retries for the unchanged spec even after the chart loads.
1 open issue
What changed in this PR
This PR moves export output collection to export time, reducing background work and publishing pending display state before screenshots.
Changes:
- Read current outputs without subscribing the auto-export component to updates.
- Add an explicit display-frame flush before screenshot capture.
- Test output freshness and absence of unnecessary export renders.
| File | Description |
|---|---|
| frontend/src/core/notebook/replica/once-per-frame.ts | Exposes synchronous flushing. |
| frontend/src/core/notebook/replica/index.ts | Exports the shared frame-source type. |
| frontend/src/core/notebook/replica/frame.ts | Adds display-frame flushing. |
| frontend/src/core/export/hooks.ts | Reads current outputs and flushes before capture. |
| frontend/src/core/export/__tests__/output-subscription.test.tsx | Checks background reads and renders. |
| frontend/src/core/export/__tests__/output-snapshot.test.tsx | Tests fresh manual and automatic export snapshots. |
| frontend/src/core/executions/atoms.ts | Separates display inputs from current export inputs. |
| frontend/src/core/executions/__tests__/atoms.test.ts | Removes the aggregate-output subscription. |
| frontend/src/__mocks__/executions.ts | Adds flushing support to mock frames. |
Review effort: Balanced
Contributor
Coverage Report for ./frontend
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kirangadhave
commented
Dec 3, 2026
kirangadhave
enabled auto-merge (squash)
December 3, 2026 02:21
mscolnick
approved these changes
Dec 3, 2026
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.

📝 Summary
Read the latest cell outputs when export starts. Previously, each output change rebuilt the full output map and re-rendered the component that owns auto-export, even between exports. If a rich output arrived just before export, the screenshot could also show the previous result. When capture needs a new screenshot, publish the pending display frame before reading the DOM.
Median frontend time across 10 alternating paired runs with 2,000 cells:
The eight updates went from eight full-map evaluations and eight React commits in the auto-export component to zero of each. The first export now pays for its snapshot. The benchmark used jsdom with one mounted output and mocked PNG encoding and network requests.
All 72 targeted frontend tests passed. A separate server test verified the latest HTML and image payload in both the manual IPYNB response and the file written by auto-export.
Part of MO-8797.