From 5baea8e2fb63aedfa6b0f88c4590d22e2ad2be03 Mon Sep 17 00:00:00 2001 From: Murat Akdeniz Date: Mon, 30 Mar 2026 22:18:37 -0700 Subject: [PATCH] Fix Share on X not preloading tweet draft on mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch from twitter.com/intent/tweet to x.com/intent/post — the legacy endpoint drops query params during mobile deep link handoff to the X app. Also separate text and url params so the link card renders independently. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/swap/SwapToast.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/swap/SwapToast.tsx b/src/components/swap/SwapToast.tsx index 46f405e1..77865f70 100644 --- a/src/components/swap/SwapToast.tsx +++ b/src/components/swap/SwapToast.tsx @@ -493,11 +493,11 @@ export function SwapToast({ hash }: { hash: string }) { if (secs <= 4.1) { fetch(`${window.location.origin}/og/preconfirm/${elapsedSec}`).catch(() => {}) } - // Embed URL in tweet text rather than using &url= param - // The &url= param causes Twitter composer to get stuck reloading state - const tweetText = `${text}\n\n${shareUrl}` + // Use x.com/intent/post (modern endpoint) with separate url param. + // twitter.com/intent/tweet drops query params during mobile deep link handoff. + // Separate &url= ensures the link card renders even if text is truncated. window.open( - `https://twitter.com/intent/tweet?text=${encodeURIComponent(tweetText)}`, + `https://x.com/intent/post?text=${encodeURIComponent(text)}&url=${encodeURIComponent(shareUrl)}`, "_blank" ) }}