Repository navigation
fix(client): polyfill crypto.randomUUID for Twitter/X iOS WebViews - #1426
kentcdodds merged 3 commits into
Conversation
Remix frame reconcile calls crypto.randomUUID(); Twitter/X iOS WebViews can omit it and abort hydration (KODY-CLOUDFLARE-4P). Install a getRandomValues-based v4 polyfill before client boot. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change adds a guarded ChangesCrypto randomUUID compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to This is a localized client compatibility fix for browsers missing crypto.randomUUID(); no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Client
participant ensureCryptoRandomUUID
participant Crypto
Client->>ensureCryptoRandomUUID: initialize during startup
ensureCryptoRandomUUID->>Crypto: check randomUUID and getRandomValues
ensureCryptoRandomUUID->>Crypto: install UUID v4 fallback when needed
Client->>Client: initialize Sentry and application
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Cast the polyfill UUID string to the DOM lib template-literal return type so worker typecheck passes. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://kody-pr-1426.kody-a99.workers.dev Worker: Mocks:
|
oxfmt check failed on the polyfill helper after the return-type cast edit. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Summary
Fixes KODY-CLOUDFLARE-4P: Remix
@remix-run/uirandomFrameIdcallscrypto.randomUUID(), which is missing in some in-app browsers (reproduced in Sentry as Twitter 12.15 on iPhone). That aborts client hydration on routes like/community.Install a
getRandomValues-based RFC 4122 v4 polyfill at the top ofclient/entry.tsxbeforerun()/ Sentry init. Leaves an existingrandomUUIDalone.Test plan
getRandomValuesnpm run typecheck/format:checkvalidateafter format fix (prior Static fail was indentation; MCP fail was flaky signup email send)System recap — composes existing primitives (low risk)
Mode: recap · Base:
main@4d104cb1· Head:568d47d5Classification: composes — adds a client boot shim so Remix's existing
crypto.randomUUID()usage works in incomplete WebCrypto environments; no primitive contracts change.Primitives touched
app-uiSystem map
Client entry polyfills missing
crypto.randomUUIDbefore Remix hydration so frame reconcile can run in restricted in-app browsers.Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context
Risk
Overall low. No auth, isolation, billing, migrations, or DR surface. Isolated client compatibility shim with unit coverage.
Docs
No doc updates required for this compatibility shim.
Summary by CodeRabbit
crypto.randomUUID()is unavailable.