Skip to content

fix: X post tips button — displaced share button, crash-hidden button, and slot flicker - #12500

Merged
guanbinrui merged 4 commits into
developfrom
fix/mf-6844-6846-post-tips-button
Oct 14, 2026
Merged

guanbinrui merged 4 commits into
developfrom
fix/mf-6844-6846-post-tips-button

Conversation

@swkatmask

Copy link
Copy Markdown
Contributor

Summary

Three fixes for the X (Twitter) post tips button, each verified live on x.com with a dev build:

mf-6844 — hidden tips slot displaced the share button

injectTipsButtonOnPost set flex: 1 on the share wrapper (leftover from the Mirror.xyz integration). Today's X sizes that wrapper to content, flush right; flex: 1 1 0% made it an extra growing item, left-aligning the share icon and leaving dead space at the action bar's right end on every post, even when the tips button was hidden. Fix: stop touching the wrapper's flex (measured on the live stock DOM: dead space 79px→0 with the button hidden; tips flush-right + share immediately before it when visible).

mf-6845 — degraded userinfo payloads crashed identity resolution

FireflyTwitter.getUserInfo trusted the proxied GraphQL shape. The backend degrades two ways: {code: 0, data: {}} (live fetch failed, nothing cached — protected accounts) crashed at res.data.data.user; __typename: 'User' without legacy (suspended/rate-limited lookups) passed validation and crashed every caller reading user.legacy.* — the reported identity.ts:119 Cannot read properties of undefined (reading 'screen_name'). Both crash paths feed the react-query entry powering PostTipsSlot, hiding that author's tips button. Fix: validate the chain and require legacy, returning null otherwise (AvailableTwitterUser keeps the guaranteed shape; wire types now model the degraded shapes).

mf-6846 — the tips button flickered (show → hide → show …)

Two stacked bugs in the injection:

  • Self-unmatching selector. div:has([aria-haspopup="menu"]):last-child — the injected span is appended right after the match, so the match stopped being :last-child, the watcher dropped/destroyed it, it matched again, re-injected… infinite add/remove at MutationObserver cadence (measured: visible → removed → empty cycle every ~150ms). :last-child only existed to disambiguate from the retweet button.
  • Full tree rebuild on every mutation. The callback hand-rolled a fresh DOMProxy + React tree on every onNodeMutation/onTargetChanged, tearing the rendered button down while the fresh tree re-resolved identity/accounts, sometimes leaving the live slot empty with the tree orphaned off-DOM.

Fix: match the share wrapper stably (the only action-bar menu button without a data-testid), use the watcher-provided DOMProxy (auto re-anchored on node replacement, auto-destroyed on removal), and mount the React tree once — remount only when the post's author changes.

Verification

  • mf-6844: live DOM measurement on stock x.com (no extension) vs injected — share flush-right restored.
  • mf-6845: backend probed for suspended (UserUnavailable), protected ({}) and healthy handles — all resolve to a complete user or null; callers degrade gracefully.
  • mf-6846: 30s of rAF-frequency width sampling on a thread page shows a single stable state — tips button on posts by an author with MaskX-verified addresses stays visible (20px), authors without verified tip accounts stay hidden, zero transitions.

Refs: MF-6844, MF-6845, MF-6846

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
book Skipped Skipped Oct 12, 2026 11:32pm UTC

Request Review

@swkatmask swkatmask changed the title fix: X post tips button — displaced share button, crash-hidden button, and slot flicker (mf-6844/6845/6846) fix: X post tips button — displaced share button, crash-hidden button, and slot flicker Oct 12, 2026
@swkatmask
swkatmask force-pushed the fix/mf-6844-6846-post-tips-button branch from 2d46e1c to b05b8fb Compare October 12, 2026 15:08
@swkatmask
swkatmask force-pushed the fix/mf-6844-6846-post-tips-button branch from b05b8fb to 197a512 Compare October 12, 2026 23:31
@swkatmask
swkatmask requested a review from guanbinrui October 14, 2026 04:34
@guanbinrui
guanbinrui merged commit ef445d9 into develop Oct 14, 2026
11 checks passed
@guanbinrui
guanbinrui deleted the fix/mf-6844-6846-post-tips-button branch October 14, 2026 09:13

This branch was previously deployed

1 inactive deployment
Preview — 197a5125 Deployed Oct 12, 2026 by vercel[bot]
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