diff --git a/documentation/PROJECT__AE_Obj_Field_Editor_New.md b/documentation/PROJECT__AE_Obj_Field_Editor_New.md new file mode 100644 index 00000000..e7b99ee2 --- /dev/null +++ b/documentation/PROJECT__AE_Obj_Field_Editor_New.md @@ -0,0 +1,202 @@ +# Project: AE Obj Field Editor — `_new` Rewrite + +**Status:** 🟡 Planning +**Priority:** Medium — quality-of-life primitive, no event deadline attached +**Created:** 2026-06-16 +**Last Updated:** 2026-06-16 +**Related:** `BOOTSTRAP__AI_Agent_Quickstart.md`, `AE__Naming_Conventions.md` + +--- + +## Background + +`src/lib/elements/element_ae_obj_field_editor.svelte` is the generic inline +field editor: given `object_type` + `object_id` + `field_name` + `current_value`, +it renders a "click pencil → edit one field → Save" UI and PATCHes just that +field via `api.update_ae_obj()`. It's used in 8 call sites today (session_view, +presenter_view, location_view, person_view, device list, presentation list, +location list, leads manage tab). + +This component already went through one rename cycle — it was originally built +as `element_ae_obj_field_editor_v3.svelte` (replacing an older CRUD v1/v2 +pattern), then renamed to drop the `_v3` suffix once it became canonical. That +migration (build new → migrate callers one at a time → delete old → drop +suffix) worked well and is the template for this project. + +**Review findings (2026-06-16)** — see `REFERENCE__Common_Agent_Mistakes.md` +context and the chat log for full detail: + +1. **Built entirely on Skeleton UI classes** (`btn-icon`, `variant-soft-*`, + `variant-filled-*`, `.input`/`.select`/`.textarea`/`.checkbox`, `badge`). + Conflicts with the stated Tailwind v4 + Flowbite/ShadCN direction. This is + the highest-leverage place to do that swap — fix once in `elements/`, + every call site benefits. +2. **`object_reload` prop is dead.** Declared, defaults to `true`, commented + "SWR pattern" — never read in the script. Every call site compensates by + hand-rolling identical `on_success={() => events_func.load_ae_obj_id__*(...)}` + boilerplate. Either implement it for real or remove it and document + `on_success` as the actual refresh mechanism. +3. **Datetime fields need manual format conversion at every call site, only + on the way in, never on the way out.** Confirmed in `session_view.svelte`: + callers must pre-convert with `to_datetime_local(...)` before passing + `current_value` because the component does no normalization between the + stored datetime string and ``'s expected + format. On save, the native datetime-local string goes straight to the + PATCH body with no reverse conversion. Works today because the backend is + forgiving, but the contract is leaky. +4. **Select-binding type mismatch is a latent landmine.** `Object.entries()` + always yields string `val`s for `