Repository navigation
fix(artifacts): preserve host-shell embed contract across in-viewer artifact links - #5238
Merged
stamp-build[bot] merged 2 commits intoNov 21, 2026
Conversation
added 2 commits
November 21, 2026 09:50
…rtifact links - Intercept full-document top-level navigations to other Artifacts (e.g. bare <a href="/artifacts/..."> in Linked from -> Documents) and un-embedded same-Artifact reloads in raftArtifactViewerRoutesDocumentAsLink so the WebView never loads an un-embedded document that latches NOT_EMBEDDED for the lifetime of the page and poisons keep-alive across subsequent opens. - Wire events.routesMainFrameNavigation symmetrically in iOS RaftIosSandboxWebView.decideNavigationPolicy (matching Android). - Add defense-in-depth embed-contract validation when reusing or parking a keep-alive WebView, and align cache metadata on dispose when stacked Artifact viewers unwind. - Compute toggled hostDesktop before running raftArtifactViewerHostDesktopScript on #host=desktop-mode so Android reloads with the updated hostDesktop value. - Add common, Android, and iOS regression tests plus 1.28.0 changeset.
…eep-alive dispose
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
Fixes #wg-mobile-feedback:#256 (Artifact viewer losing the host-shell embed contract after opening another Artifact from an in-page link such as Linked from › Documents, then breaking Desktop Mode / one-bar /
hostOpen=messageacross subsequent Artifact opens).Root cause
ArtifactBacklinksList.tsx:137<a href="/artifacts/<otherId>">) insideArtifactStandalonePagetriggers a full-document navigation to/artifacts/<otherId>with no?embed=raft-settings-v1&shell=host&back=host&hostMenu=...&hostOpen=message&hostConversation=...query params.raftArtifactViewerRoutesDocumentAsLinkpreviously returnedfalseforOpenArtifact(and iOSRaftIosSandboxWebView.decideNavigationPolicydid not invokeevents.routesMainFrameNavigation), allowing the WebView to replace its embedded document with an un-embedded full page load.conversationId != null,onAddressmatchedraftArtifactViewerSwitchesInPlaceand falsely recorded that un-embedded WebView inRaftArtifactViewerMemorykeep-alive. Becauseslockembed.tslatchesNOT_EMBEDDEDsynchronously on document boot, subsequent opens reusing that keep-alive WebView viahistory.pushStaterendered withisHostShell() === false— causing stacked native + web headers, desktop-widthArtifactDetailsTitleon phones in Desktop Mode, andOriginal messageclosing the viewer instead of opening over via#host=open&to=.LaunchedEffect(pendingHostAction)wrote the pre-togglehostDesktopvalue to the address right beforetoggleDesktopMode("page")triggered Android'supdateUseWideViewPortreload.Changes
RaftArtifactViewer.kt):raftArtifactViewerHasEmbedContract(url),raftArtifactViewerKeptDocumentHasEmbedContract(kept), andraftArtifactViewerHostDesktopAfterAction(action, current).raftArtifactViewerRoutesDocumentAsLinkto returntruefor full-document navigations to another Artifact (OpenArtifact) and un-embedded full reloads of the same Artifact (Stay && !raftArtifactViewerHasEmbedContract(url)), while leaving embedded same-Artifact loads, warm route, sign-out (/,/login), and post-delete (/s/<slug>) untouched. Client-side SPA switches (history.pushState) never enterroutesMainFrameNavigation.RaftSandboxWebView.ios.kt):events.routesMainFrameNavigationinsideRaftIosSandboxWebView.decideNavigationPolicymatching Android'sshouldRouteMainFrameNavigation.RaftArtifactViewerPage.kt):RaftArtifactViewerMemorymetadata on dispose when stacked Artifact viewers unwind.OpenArtifactininColumnviaopenRaftArtifactViewerPage(matchingLeft), and handle un-embedded same-Artifact version links via in-place SPA navigation.nextHostDesktoptoraftArtifactViewerHostDesktopScriptbeforecurrentOnHostActiontriggers Android's Desktop Mode reload.RaftArtifactViewerEmbedTest.kt,RaftArtifactViewerCacheTest.kt,RaftAndroidArtifactViewerWebViewRulesTest.kt, andRaftSandboxWebViewNavigationFenceIosTest.kt.change-logs/1.28.0/changesets/artifact-viewer-preserve-embed-contract.md.Upstream note (web)
botiverse/slockpackages/web/src/apps/artifacts/embed.tsandArtifactBacklinksList.tsxwere checked against localslockHEAD; mobile now guards the embed contract independently of whether web backlinks trigger a hard<a href>navigation.