Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(lightbox): prevent no-op on first image download on iOS (#3843)
Peter Chinman4e824364f124
diff --git a/js/app/packages/core/component/Lightbox.tsx b/js/app/packages/core/component/Lightbox.tsxindex fe3c4fc51a..7505bba43a 100644--- a/js/app/packages/core/component/Lightbox.tsx+++ b/js/app/packages/core/component/Lightbox.tsx@@ -68,15 +68,32 @@ export function Lightbox(props: LightboxProps) {// gesture — the user-activation window expires if a network round-trip is// needed. Desktop clipboard doesn't have this constraint.const [cachedBlob, setCachedBlob] = createSignal<Blob | undefined>();+ // True while the iOS pre-fetch is in flight. We surface this as a loading+ // state on the copy/download buttons so the blob is guaranteed to be in+ // memory before the user can tap. Without this, tapping download on a large+ // image (whose pre-fetch hasn't finished yet) falls through to an awaited+ // network fetch, which consumes the tap's user activation and makes+ // navigator.share() silently no-op until a second tap.+ const [isPrefetching, setIsPrefetching] = createSignal(false);if (isIOS) {createEffect(() => {- props.src(); // re-fetch when navigating to a new image+ const currentSrc = props.src(); // re-fetch when navigating to a new image+ let isStale = false;+ onCleanup(() => {+ isStale = true;+ });+setCachedBlob(undefined);+ setIsPrefetching(true);untrack(() => fetchBlob()).then((blob) => {+ if (isStale || props.src() !== currentSrc) return;if (blob) setCachedBlob(blob);})- .catch(() => {});+ .catch(() => {})+ .finally(() => {+ if (!isStale && props.src() === currentSrc) setIsPrefetching(false);+ });});}const fetchBlobCached = (): Promise<Blob | undefined> => {@@ -288,7 +305,7 @@ export function Lightbox(props: LightboxProps) {variant="ghost"size="icon-md"onClick={copyToClipboard}- disabled={isCopying()}+ disabled={isCopying() || isPrefetching()}label="Copy image">{isCopying() ? <SpinnerIcon /> : <ClipboardIcon />}@@ -297,7 +314,7 @@ export function Lightbox(props: LightboxProps) {variant="ghost"size="icon-md"onClick={downloadImage}- disabled={isDownloading()}+ disabled={isDownloading() || isPrefetching()}label="Download image">{isDownloading() ? <SpinnerIcon /> : <DownloadIcon />}