From a8ed6073a997a787904de30d9736407337f600e0 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Tue, 19 May 2026 15:48:10 -0700 Subject: [PATCH] File fields: surface a prior-attachment indicator from RHF prefill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The earlier 'Currently on file' indicator hung off readonlyValue, which is sourced from evalState (only carries current_stage). For file fields the prefill lives in RHF state, not in evalState, so the indicator never fired. Replaced with a FilePriorIndicator subcomponent that subscribes to the field's RHF value via useWatch and renders a small leaf-50 banner with a paperclip glyph when a previous attachment is present. Falls silent the moment the user picks a new file (RHF value becomes a FileList). Filename is derived from whatever shape Civi returned — bare string, object with file_name/name/label/filename, or numeric file id (generic message in that case). --- components/fields/FieldRenderer.tsx | 72 +++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/components/fields/FieldRenderer.tsx b/components/fields/FieldRenderer.tsx index e5905e3..7b27b4f 100644 --- a/components/fields/FieldRenderer.tsx +++ b/components/fields/FieldRenderer.tsx @@ -203,16 +203,10 @@ export function FieldRenderer({ // ── File ──────────────────────────────────────────────────────────────── if (field.type === "file") { - const priorName = typeof readonlyValue === "string" ? readonlyValue : ""; - const hasPrior = priorName.length > 0; return ( -
+