fix(code): route all markdown link clicks through openExternal#2381
Closed
annikaschmid wants to merge 1 commit into
Closed
fix(code): route all markdown link clicks through openExternal#2381annikaschmid wants to merge 1 commit into
annikaschmid wants to merge 1 commit into
Conversation
PR #2241 added explicit handling for `posthog-code://` deeplinks in the chat markdown renderer, but the new `onClick` short-circuited for every other URL — leaving plain `https://` links inert when clicked. Drop the `isDeeplink` guard so any link with an `href` is sent through `trpcClient.os.openExternal`, the same path the deeplink branch already uses. Generated-By: PostHog Code Task-Id: 893f622d-2bda-4581-9498-200848518353
Contributor
|
Reviews (1): Last reviewed commit: "fix(code): route all markdown link click..." | Re-trigger Greptile |
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
External
https://links rendered inside chat / agent messages were inert when clicked — they appeared correctly (with the external-link glyph), but did nothing. The regression was introduced in #2241, which added anonClickhandler to the markdown<a>renderer forposthog-code://deeplinks and short-circuited every other URL:For non-deeplink URLs the click was left to
target="_blank"+ the main process'ssetWindowOpenHandlerfallback, which on at least some setups was not actually opening the URL in the system browser.This change drops the
isDeeplinkguard so every link with a realhrefis routed throughtrpcClient.os.openExternal— the same path the deeplink branch already uses.setupExternalLinkHandlersinapps/code/src/main/window.tsremains as a defensive safety net for any stray navigations from elsewhere in the renderer.The
isPostHogCodeDeeplinkimport is still in use formarkdownUrlTransform(sodefaultUrlTransformdoesn't strip the custom scheme); only the unused local in thearenderer was removed.Test plan
https://link (e.g. ask the agent for a PostHog insight URL). Click the link → opens in the default system browser.posthog-code://deeplink (e.g. via Inbox → Discuss). Deeplink still routes correctly.GithubRefChippath is unaffected (returns before the modified onClick).setWindowOpenHandlerreturnsaction: "deny").Created with PostHog Code