{ submitting = true; let reachedReturn = false; try { const photo = formData.get('photo'); if (photo instanceof File && photo.size > 0 && photo.type.startsWith('image/')) { try { const small = await downscaleImage(photo); if (small) formData.set('photo', small, 'photo.jpg'); } catch { /* keep original file */ } } reachedReturn = true; } finally { if (!reachedReturn) submitting = false; } return async ({ update }) => { submitting = false; await update(); }; }} > {#if version !== undefined}
{/if}
Description
Amount ({currency})
Date
Paid by
Choose…
{#each members as m (m.id)}
{m.displayName}
{/each}
Notes (optional)
Receipt photo (optional)
{#if existingPhoto}
Remove current photo
{/if}
{submitting ? 'Saving…' : submitLabel}