Skip to content

Fix note download claim timing (avoid unmounting download button before click)#365

Merged
kojibai merged 1 commit intomainfrom
codex/fix-download-button-unmounting-issue
Feb 1, 2026
Merged

Fix note download claim timing (avoid unmounting download button before click)#365
kojibai merged 1 commit intomainfrom
codex/fix-download-button-unmounting-issue

Conversation

@kojibai
Copy link
Copy Markdown
Owner

@kojibai kojibai commented Feb 1, 2026

Motivation

  • Pointer/touch event handlers were causing noteClaimedImmediate to be set before the click handler, which can unmount the download button and prevent the actual PNG download from running.
  • On mobile this produced inconsistent global claim state because the immediate UI flip could race with registry/storage updates.
  • The intent is to preserve the bypass behavior for already-claimed notes while deferring mutation that may unmount the button until after the download attempt completes.

Description

  • Removed the separate claimNow pointer-driven flow and instead set noteDownloadBypassRef.current = true at the start of onDownloadNotePng so the download button is not unmounted preemptively.
  • Updated onDownloadNotePng to perform the PNG generation/download and only call confirmNoteSend() in the finally block so claim state and registry updates happen after the download attempt.
  • Simplified the download button markup by removing onPointerDown/onTouchStart handlers and relying on onClick={onDownloadNotePng} to avoid premature state flush/unmounts.
  • Adjusted the useCallback dependency list for onDownloadNotePng to remove the removed claimNow and keep correct dependencies.

Testing

  • No automated tests were executed for this change.

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 1, 2026

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

Project Deployment Actions Updated (UTC)
phi-network-5aii Ready Ready Preview, Comment Feb 1, 2026 1:52am

Request Review

@kojibai kojibai merged commit 8701c4c into main Feb 1, 2026
1 of 2 checks passed
kojibai added a commit that referenced this pull request Feb 1, 2026
ΦNet Release Notes — v43.0.0

Theme: Exhale Note global-claim propagation is now PWA-proof (without breaking desktop).

🔥 Highlights

Global claim propagation is fixed end-to-end for Exhale Notes (including PWA). Claims now propagate reliably even when the iOS “Save / Share / Download” sheet temporarily background-suspends or refreshes the app.

Sigil Explorer API routing is hardened. The client now avoids the “POST/GET /sigils/* → 404 on the static host” loop that was hammering retries and cascading into state loss. This is the v42.9.14 hardening that stabilized cleared-cache + PWA flows.

Note rotation is now deterministic: when you download a fresh note PNG (child), the parent is confirmed/claimed correctly (and the child stays unclaimed).

✅ What Changed
PWA + Mobile Reliability (the core fix)

Fix global claim propagation in PWA (merged) and ship PWA-specific claim reliability work.

Probe inhale online status in PWA to prevent false “offline” behavior during iOS lifecycle transitions.

Fix PWA note claim propagation so claim state survives the download/save lifecycle and returns globally.

VerifyPage: Note download / claim timing (no more “claimed on desktop, not on mobile/PWA”)

Confirm parent note when downloading fresh PNG (this is the canonical behavior: parent gets claimed after minting child).

Fix note claim confirmation for downloaded PNGs (tightens metadata + registry state).

Fix note download claim timing (prevents lifecycle races).

Trigger note download on pointer events (prevents unmount/gesture timing issues on mobile).

Allow note download while claiming / after immediate claim (removes deadlocks and “stuck” states).

Update note claim state on download (ensures registry + UI reflect the new truth immediately).

Mobile regressions explicitly handled

Fix mobile note claim update before download (attempted) and then reverted when it introduced incorrect behavior.

Avoid claiming rotated fresh exhale notes (prevents accidentally claiming the newly minted child).

Prevent re-downloading claimed exhale notes on mobile (stops repeat-spend UX).

Version trail included in this release package

This release consolidates the v42.9.x stabilization train through v42.9.14 into a single “this is now stable” drop.

🧠 Why it broke (the real root cause)

What you saw (“works in Safari, breaks in PWA when the save sheet pops”) is classic iOS PWA lifecycle behavior: the standalone app can be backgrounded, suspended, or reloaded during the system download/save UI. If your /sigils/* calls temporarily routed to the wrong base (static host → 404), the inhale/registry flush never completed, and the claim never made it into the durable registry—so after the refresh, the UI looked “unclaimed.”
This release fixes that by hardening the API client routing + PWA-specific claim/inhale propagation paths.

Deployment Notes

PWA users: after updating, fully close the PWA and relaunch once to ensure the latest service worker + assets are active (this matters specifically for the “save sheet” lifecycle).

If you host on a non-API domain (e.g., static frontend): the /sigils/* client must resolve to the Lah-Mah-Tor API domains (or a real configured proxy). This release’s API client hardening is what prevents the 404 retry storm.

Full Changelog (by PR / commit)

#384 fix-global-claim-propagation-in-pwa

“Probe inhale online status in PWA”

“Fix PWA note claim propagation”

#373 fix-regression-in-verifypage.tsx

“Confirm parent note when downloading fresh PNG”

“Fix note claim confirmation for downloaded PNGs”

#367 revert mobile claimed-status investigation

#366 investigate mobile claimed status issue

#365 fix-download-button-unmounting-issue

#364 handle immediate claim + download flow

#362 fix-mobile-exhale-note-claimed-status
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