{ 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}
{#if existingPhoto} Current receipt {/if}