From 4e4273c27bab2265c82b3a14d1adaaa955866592 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 7 Apr 2026 11:46:22 -0400 Subject: [PATCH] fix: persist form data across visits, don't overwrite local edits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep submitted data in localStorage so "Resume" works on return visits. Stop overwriting local edits with older server data during resume — email lookup now only sets the update flag, preserving local changes. Co-Authored-By: Claude Opus 4.6 --- apply.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apply.html b/apply.html index e92ef2b..44ad1c6 100644 --- a/apply.html +++ b/apply.html @@ -1082,7 +1082,7 @@ currentStep = 1; showStep(1); - // If we have an email, check server for existing application + // If we have an email, check if application exists in DB (just set the update flag) if (email) { try { const resp = await fetch('/api/application/lookup?email=' + encodeURIComponent(email)); @@ -1093,10 +1093,8 @@ alert('This email already has a completed (paid) application. Contact us at contact@valleyofthecommons.com if you need to make changes.'); return; } - // Silently load server data over localStorage data + // Just flag for PUT on submit — localStorage already has the latest edits window._existingApplicationId = result.application.id; - restoreFormData(result.application); - saveFormData(); } } } catch (e) { @@ -1722,8 +1720,8 @@ const result = await response.json(); if (response.ok && result.success) { - // Clear saved data - localStorage.removeItem(STORAGE_KEY); + // Save submitted data so "Resume" works on next visit + saveFormData(); // Show success state document.getElementById('confirm-name').textContent = data.first_name;