diff --git a/src/components/Hack/HackActions.tsx b/src/components/Hack/HackActions.tsx index cb30126..da451b7 100644 --- a/src/components/Hack/HackActions.tsx +++ b/src/components/Hack/HackActions.tsx @@ -221,13 +221,16 @@ const HackActions: React.FC = ({ deviceId = crypto.randomUUID(); localStorage.setItem(key, deviceId); } - const deviceIdObscured = deviceId.split("-"); - const result = await updatePatchDownloadCount(patchId, deviceIdObscured); - if (!result.ok) { - console.error(result.error); - } else if (result.didIncrease) { - window.dispatchEvent(new CustomEvent("hack:patch-applied", { detail: { slug: hackSlug } })); - } + // Defer update to next tick to avoid Safari cancelling the request + setTimeout(async () => { + const deviceIdObscured = deviceId.split("-"); + const result = await updatePatchDownloadCount(patchId, deviceIdObscured); + if (!result.ok) { + console.error(result.error); + } else if (result.didIncrease) { + window.dispatchEvent(new CustomEvent("hack:patch-applied", { detail: { slug: hackSlug } })); + } + }, 0); } } catch {} } catch (e: any) {