Skip to content

perf(web): only mount Coinflow purchase protection when signed in - #14709

Merged
dylanjeffers merged 1 commit into
mainfrom
perf/coinflow-protection-signed-in
Oct 26, 2026
Merged

dylanjeffers merged 1 commit into
mainfrom
perf/coinflow-protection-signed-in

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Summary

CoinflowPurchaseProtection (nsure plus the CoinflowCardForm fingerprinting chunk) mounts for every visitor once the browser goes idle, even signed out. On a mobile Lighthouse run of signed-out prod /trending (2026-10-26), that chunk was the single most expensive script: 3.6s of bootup and two long tasks over 500 ms. That's more than the entry chunk itself. The page scored 27 with 3.0s of TBT.

Signed-out visitors can't check out, so DeferredCoinflowPurchaseProtection now waits for useHasAccount() before mounting. Nothing else changes: the idle deferral and the props are the same, and Ray's session-key work in useCoinflowSessionKey (#14674) isn't touched.

Behavior change to check: protection now starts at sign-in or account load, not at first idle. For returning users the account loads from local storage at boot, so it should be the same. For someone who signs up and buys right away, nsure has less time collecting signals before checkout. @raymondjacobson, does Coinflow need a minimum lead time, or could this be a problem given the recent Coinflow issues?

Testing

  • Local dev against prod, signed out, /trending: no coinflow, nsure or fingerprint requests 12+ s after load (prod loads all four Coinflow chunks on the same page).
  • tsc --noEmit for web and ESLint on the file pass.
  • Not tested: a signed-in purchase. The signed-in render path is unchanged apart from the gate, but a sandbox purchase on staging would confirm it.

🤖 Generated with Claude Code

CoinflowPurchaseProtection pulls in nsure and a device fingerprinting
chunk that costs about 3.6s of main-thread time on a throttled mobile
Lighthouse run of signed-out /trending. Signed-out visitors can't check
out, so wait for an account before mounting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 830e225

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers
dylanjeffers merged commit 6d5ec44 into main Oct 26, 2026
18 checks passed
@dylanjeffers
dylanjeffers deleted the perf/coinflow-protection-signed-in branch October 26, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant