Skip to content

fix(share): copy absolute world and tool links - #6641

Merged
idoshamun merged 1 commit into
mainfrom
fix-absolute-share-links
Sep 10, 2026
Merged

fix(share): copy absolute world and tool links#6641
idoshamun merged 1 commit into
mainfrom
fix-absolute-share-links

Conversation

@idoshamun

@idoshamun idoshamun commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem

webappUrl is process.env.NEXT_PUBLIC_WEBAPP_URL, which is a bare / on the webapp and absolute only in the extension. The world share button and the tool page share button built their links as ${webappUrl}world/... and ${webappUrl}tools/..., so the clipboard got /world/<user> and /tools/<slug>, which is a dead link once pasted.

Fix

  • New getAbsoluteWebappUrl(path) in packages/shared/src/lib/links.ts. It resolves the path against location.origin and leaves an absolute webappUrl (the extension) untouched. This is the approach agentShareLink already used and the one feat(snapshot): snapshot an expanded highlight on Happening Now #6570 adds for Happening Now, pulled into one helper.
  • Used in WorldShare, the tool page share, and agentShareLink (which no longer carries its own copy).
  • Audit of the other useShareOrCopyLink / useCopyLink / navigator.clipboard call sites: the rest copy backend permalinks, location.href, or origin-built URLs. The one other case was useSourceMenuProps, which fell back to a bare webappUrl when a source had no permalink. That copied / and threw in addLogQueryParams once the share_source cid was attached, so it now uses the helper too.
  • Tracking: the world and tool links now pass cid through useShareOrCopyLink (new share_world and share_tool campaign keys), like the other share buttons, so they get the referral userid/cid params and the shortener. pages/join maps both to the generic referral screen, and useReferralConfig already falls back to the default config.

Relation to #6570

#6570 (still open) adds getHighlightsShareUrl() with the same origin logic. Whichever PR merges second should switch it to getAbsoluteWebappUrl('highlights'). The ReferralCampaignKey enum and the join page map both gain entries in both PRs, so expect a trivial conflict there.

Tests

With webappUrl at / (the webapp and shared jest setups):

  • WorldShare.spec.tsx: the old assertions expected the relative /world/ido and have been changed to expect the absolute link. There is also a cid check, plus a test that goes through the real share pipeline and asserts the clipboard gets http://localhost/world/ido?userid=...&cid=share_world.
  • ToolPage.spec.tsx: clicking Share writes http://localhost/tools/docker?userid=...&cid=share_tool to the clipboard.
  • links.spec.ts: the helper resolves against the origin, returns the home page when called with no path, and passes an absolute webappUrl through.

Checks run: node ./scripts/typecheck-strict-changed.js, eslint on the changed files, the affected shared specs, the full webapp jest suite (86 suites, 692 tests), and the full webapp tsc (no errors in changed files).

Preview domain

https://fix-absolute-share-links.preview.app.daily.dev

`webappUrl` is a bare `/` on the webapp (it is absolute only in the
extension), so the world and tool share buttons put `/world/<user>` and
`/tools/<slug>` on the clipboard, which is a dead link once pasted.

Add `getAbsoluteWebappUrl(path)` to lib/links. It resolves the path against
`location.origin`, the approach `agentShareLink` already took, and leaves an
absolute `webappUrl` untouched. Use it for the world share, the tool page
share, `agentShareLink`, and the source share fallback, which copied `/`
when a source had no permalink and threw in `addLogQueryParams` once a cid
was attached.

The world and tool links now carry `share_world` and `share_tool` campaign
ids through `useShareOrCopyLink`, like the other share buttons, so they get
the referral `userid`/`cid` params and the shortener. The join page maps
both to the generic referral screen.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Sep 10, 2026 3:43pm UTC

Request Review

@idoshamun
idoshamun merged commit 88cf2a6 into main Sep 10, 2026
11 checks passed
@idoshamun
idoshamun deleted the fix-absolute-share-links branch September 10, 2026 19:18
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.

1 participant