Repository navigation
perf(web): only mount Coinflow purchase protection when signed in - #14709
Merged
Merged
Conversation
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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CoinflowPurchaseProtection(nsure plus theCoinflowCardFormfingerprinting 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
DeferredCoinflowPurchaseProtectionnow waits foruseHasAccount()before mounting. Nothing else changes: the idle deferral and the props are the same, and Ray's session-key work inuseCoinflowSessionKey(#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
/trending: nocoinflow,nsureorfingerprintrequests 12+ s after load (prod loads all four Coinflow chunks on the same page).tsc --noEmitfor web and ESLint on the file pass.🤖 Generated with Claude Code