Skip to content

feat(channels): add shareable deep links for channels and threads#3157

Draft
k11kirky wants to merge 1 commit into
mainfrom
posthog-code/channel-share-links
Draft

feat(channels): add shareable deep links for channels and threads#3157
k11kirky wants to merge 1 commit into
mainfrom
posthog-code/channel-share-links

Conversation

@k11kirky

@k11kirky k11kirky commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Channels (project-bluebird) had no way to be shared. Canvases already have a "Copy link" that deep-links into the desktop app via a Cloud interstitial, but there was no equivalent for a channel itself, or for a thread inside one.

Changes

  • Copy link on a channel — new "Copy link" action in the sidebar channel menu (hover dropdown and right-click context menu share the same action list).
  • Copy link on a thread — link button in the channel task header's trailing slot, next to the external-apps opener; only rendered when the task is viewed inside a channel.
  • Both copy an https link (<instance>/code/channel/<channelId>[/tasks/<taskId>]) that resolves to a web interstitial firing the new posthog-code://channel/... scheme, mirroring the canvas share-link pattern — so links work whether or not the recipient has the app. Companion interstitial PR: feat(code): add channel share link interstitial for posthog code posthog#68479.
  • Inbound handling mirrors canvas: a ChannelLinkService registers the channel scheme handler (queues links that arrive before the renderer is ready), exposed via deepLink.onOpenChannel / getPendingChannelLink, consumed by useChannelDeepLink which navigates to the channel home or the thread view.
  • Instrumented: Channel action with action_type: "copy_link" (thread copies carry task_id) on copy, new Deep link channel event on open. Affordances only render inside the Channels space, which is gated by the project-bluebird flag at the route.
  • Documented in docs/DEEP-LINKS.md.

How did you test this?

  • New unit tests for ChannelLinkService (11 tests: path parsing incl. URL-encoded segments and malformed-path rejection, pending-link queue/drain, window focus/restore).
  • Ran the core links/ suite (87 tests) and the UI canvas / deep-links / task-detail suites (119 tests) — all pass.
  • Full-repo pnpm typecheck and Biome clean.
  • Not run: end-to-end click-through in the packaged app (no desktop environment in this session).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

"Copy link" on a channel (sidebar dropdown + context menu) and on a thread (channel task header) copies an https link that resolves to a Cloud interstitial firing the new posthog-code://channel/<channelId>[/tasks/<taskId>] scheme, mirroring the canvas share-link pattern end to end (ChannelLinkService, deepLink router endpoints, useChannelDeepLink).

Generated-By: PostHog Code
Task-Id: b60d15a7-ac68-4869-bb42-55e66943823a
@trunk-io

trunk-io Bot commented Jul 5, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit d912d55.

@greptile-apps

greptile-apps Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/core/src/links/channel-link.test.ts, line 241-274 (link)

    P2 Non-parameterised success-path emission tests

    The three happy-path tests (channel-only link, thread link, URL-encoded segments) are written as separate it blocks but follow the exact same arrange/act/assert shape and could be collapsed into a single it.each. The rejection cases already use it.each. Keeping these three as individual blocks is inconsistent with the project convention of preferring parameterised tests, and makes adding new valid-path variants more error-prone.

    Context Used: Do not attempt to comment on incorrect alphabetica... (source)

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "feat(channels): add shareable deep links..." | Re-trigger Greptile

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.

2 participants