Fix mobile browser tab tombstoning issue in sandbox renderer - #75
Merged
Dan Marshall (danmarshall) merged 5 commits intoSep 11, 2025
Merged
Conversation
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] On mobile browsers, the host package sandbox renderer does not show content if tab was tombstoned and revisited
Fix mobile browser tab tombstoning issue in sandbox renderer
Sep 9, 2025
Dan Marshall (danmarshall)
marked this pull request as ready for review
September 10, 2025 00:48
Dan Marshall (danmarshall)
approved these changes
Sep 10, 2025
Dan Marshall (danmarshall)
deleted the
copilot/fix-b0b8691c-bffb-4201-a0f6-0f2c02b72b1f
branch
September 11, 2025 18:39
Collaborator
|
Copilot although this was merged and branch deleted, but problem still isn’t solved |
Merged
6 tasks
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.
Fixes an issue where on mobile browsers, the host package sandbox renderer does not show content if the tab was tombstoned and revisited.
Problem
Mobile browsers can "tombstone" tabs to save memory by pausing JavaScript execution and cleaning up resources. When this happens:
URL.createObjectURL()may be garbage collectedSolution
This PR adds page visibility API event handling to automatically detect when a tab is restored from tombstoning and recreate the sandbox content if needed.
Key Changes
currentMarkdownproperty for potential restorationvisibilitychangeevents to detect when tab becomes visible againisSandboxFunctional()method to test if the sandbox iframe is still accessibledestroy()methodImplementation Details
The fix is implemented entirely in
packages/host/src/listener.tswith minimal, surgical changes:Testing
Created and validated a comprehensive test that demonstrates:
Impact
The fix ensures that Chartifact interactive documents remain accessible and functional even after mobile browser tab tombstoning, providing a much better user experience on mobile devices.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.