diff --git a/src/routes/(app)/favorites/+page.svelte b/src/routes/(app)/favorites/+page.svelte index 5d5d3bf..f4f8c1a 100644 --- a/src/routes/(app)/favorites/+page.svelte +++ b/src/routes/(app)/favorites/+page.svelte @@ -27,18 +27,20 @@ let reelContainer: HTMLDivElement | null = $state(null); let showViewers = $state(false); - // History management — push a state entry when the reel opens so the - // Android back gesture (and browser back button) closes it instead of - // navigating away from the favorites page entirely. + // Push a history entry when reel opens so back gesture closes it, not navigates away. let reelClosedViaBack = false; let reelDismissed = false; function onReelPopState() { - reelClosedViaBack = true; - closeReel(); + // Defer so page.state is updated before we inspect it. If favReel is still + // set, a sheet on top closed — don't dismiss the reel. If gone, close it. + setTimeout(() => { + if (page.state.favReel || viewMode !== 'reel') return; + reelClosedViaBack = true; + closeReel(); + }, 0); } - // Close viewers sheet when scrolling to a different clip $effect(() => { // eslint-disable-next-line sonarjs/void-use -- read activeIndex to re-run on scroll void activeIndex; @@ -46,7 +48,6 @@ }); const currentUserId = $derived(page.data.user?.id ?? ''); - const autoScroll = $derived(page.data.user?.autoScroll ?? false); const gifEnabled = $derived(!!page.data.gifEnabled); const renderWindow = 2; @@ -138,7 +139,6 @@ if (slot) slot.scrollIntoView({ behavior: 'smooth' }); } - // IntersectionObserver to track active clip in reel mode $effect(() => { if (viewMode !== 'reel' || !reelContainer) return; // eslint-disable-next-line sonarjs/void-use -- re-run when clips change @@ -234,7 +234,7 @@ {currentUserId} active={i === activeIndex} index={i} - {autoScroll} + autoScroll={false} {gifEnabled} canEditCaption={clip.addedBy === currentUserId} seenByOthers={clip.seenByOthers} diff --git a/src/routes/share/+page.svelte b/src/routes/share/+page.svelte index 0bae578..e6be64e 100644 --- a/src/routes/share/+page.svelte +++ b/src/routes/share/+page.svelte @@ -15,7 +15,6 @@ import ExportIcon from 'phosphor-svelte/lib/ExportIcon'; const shareUrl = $derived($page.data.shareUrl as string); - const fromShortcut = $derived($page.data.fromShortcut as boolean); const platform = $derived(platformLabel(shareUrl)); const isValid = $derived(isSupportedUrl(shareUrl)); const detectedPlatform = $derived(shareUrl ? detectPlatform(shareUrl) : null); @@ -36,6 +35,14 @@ let success = $state(false); let clipId = $state(''); let contentType = $state(''); + let autoSubmitted = $state(false); + + $effect(() => { + if (isValid && platformAllowed && !autoSubmitted) { + autoSubmitted = true; + handleSubmit(); + } + }); async function handleSubmit() { error = ''; @@ -105,30 +112,26 @@