Skip to content

Fix mobile download prompt detection timing - #93

Open
feynon wants to merge 5 commits into
mainfrom
codex/fix-download-prompt-card-on-mobile
Open

Fix mobile download prompt detection timing#93
feynon wants to merge 5 commits into
mainfrom
codex/fix-download-prompt-card-on-mobile

Conversation

@feynon

@feynon feynon commented Apr 18, 2026

Copy link
Copy Markdown
Member

Motivation

  • The mobile download prompt sometimes failed to open for homepage/top-nav download taps because device detection was deferred into a state initialized in useEffect, causing the click handlers to be gated until that state was set.
  • The global capture listener was similarly gated on a separate mobile state which made interception unreliable immediately after page load.

Description

  • Removed the deferred isMobile state from useMobileDownloadPrompt and changed the hook to call isLikelyMobileDevice() at click time so openMobileDownloadPrompt reliably returns true on mobile immediately after load.
  • Simplified GlobalMobileDownloadPrompt by removing separate mobile-state gating and performing isLikelyMobileDevice() checks inside the document click handler registered in the capture phase so download link clicks are intercepted consistently.
  • Kept existing behavior for skip attributes and same-origin/download-host detection while reducing dependency array complexity and state churn in components/mobile-download-prompt.tsx.

Testing

  • Ran npm run lint, which failed in this environment because ESLint configuration was not detected (ESLint couldn't find an eslint.config.(js|mjs|cjs) file).
  • Ran npm run build, which failed in this environment due to external Google Fonts TLS/fetch errors during the Next.js build (unrelated to the changed logic) and optional external package warnings from @react-email/render.

Codex Task

@vercel

vercel Bot commented Apr 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tiles-next Ready Ready Preview, Comment, Open in v0 Apr 18, 2026 6:48am

Request Review

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