From 77cf865ddcb0f0ee9028157239dea7d9695b1fd4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 1 Jun 2026 18:17:12 +0000 Subject: [PATCH] Fix project code not persisting across page reloads ct-pick was missing data-ls so the selected charge-to client was never saved. On reload, the pcode select was rebuilt with global project codes, so client-specific codes (e.g. AC-100) couldn't be restored. Fix: persist ct-pick, then in restoreStorage call fillChargeTo() to rebuild the correct project code options before re-applying the saved pcode value. Also re-save after to fix any intermediate state written by fillChargeTo's currency auto-set. https://claude.ai/code/session_0151QtsUhzXmgzEhSvXG2SDt --- app/index.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index f9fc83d..3abcfec 100644 --- a/app/index.html +++ b/app/index.html @@ -555,7 +555,7 @@ function buildForm() {
${t("charge-to")}: - ${ctOpts} @@ -1049,6 +1049,17 @@ function restoreStorage() { if (el) el.value = v; }); + // Restore charge-to: rebuild its project code options then re-apply pcode. + // fillChargeTo() calls updateProjectCodes() which resets the pcode select, + // and may call saveStorage() mid-flow, so we re-apply and re-save after. + const ctPickEl = document.getElementById("ct-pick"); + if (ctPickEl?.value) { + fillChargeTo(ctPickEl.value); + const pcodeEl = document.getElementById("pcode"); + if (pcodeEl && d.pcode) pcodeEl.value = d.pcode; + saveStorage(); + } + // Restore "Other" project-code visibility if (d.pcode === "__other__") { const w = document.getElementById("pcode-other-wrap");