You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shift-type editor: adding a position silently fails to save (front-end) #533
Reported by Chipper (2026-07-13). She added a new position (DataBeast Technician, for the Setup type — 0 slots default, 1 slot / 12 CSP on PreFri) via the shift-type editor and saved. It silently didn't persist — op_shift_time_position has zero rows for the position, and there's no server error in the prod logs.
Key finding: backend is fine, front-end is the bug
The API PATCH handler works — I re-ran the exact scenario (add DataBeast to all Setup times, PreFri at 1/12) directly against the fixed backend (post-#528) and it persisted perfectly. So this is a client-side bug in the shift-type editor: the added position never makes it into the PATCH payload.
handlePositionAdd (~L269): guarded by if (positionFound) (name-match against dataDefaults.positionList) — silently no-ops if not found (no snackbar, no error). Verify positionFound resolves for a newly-created position.
It mutates via structuredClone(timeFields) → timeReplace(...), pushing the position into each nestedtimeList[].positionList. Likely react-hook-form nested-field-array / getValues() desync: the nested push may not be reflected in the values processTimeList(getValues()) reads at submit (~L131 processTimeList sends each time's positionList verbatim).
Repro
Edit a shift type → add a position via the dialog → save → check op_shift_time_position: the new position isn't there.
Impact / workaround
Blocks adding positions to shift types via the UI. Immediate unblock is a direct DB insert of the op_shift_time_position row(s). Needs a proper front-end fix + a re-test that the editor persists an added position (and the per-time slots/CSP override).
Live prod repro (2026-08-15, Chipper) — fix #560/#528 does NOT cover this path.
Chipper added a new instance of the Tech Support shift type for Pre-event Sunday, clicked Save; it does not appear on the Shifts List. The row saved in a broken state:
start_date_id = NULL — never linked to the PreSun date (date_id 5)
remove_shift_time = 1 — flagged removed on creation
its single op_shift_time_position row has remove_time_position = 1 → 0 active positions
Shifts List query excludes it (needs remove_shift_time=false AND an INNER join to a non-removed op_shift_time_position). Working Tech Support instances (Open Sun–Fri, ids 70–75) each have a date, remove=0, 1 active position.
So adding a brand-new instance for a new date still silently fails to persist correctly (no date set, row + position left in the removed state) — distinct from the empty-required-field no-op fixed in #560. Also confirms the offline-server create concern (#111): broken online ⇒ broken offline.
Root cause (2026-08-15, prod data + code trace). Three compounding issues:
1. Hidden save button (UX). The Shift-Type editor is two-step: the dialog's Add time only stages the row in the form; nothing persists until Update shift type — a pink button at the very bottom of the page, below the footer/fold. Easy to miss entirely, so "I added a time and it vanished" often = the commit button never got clicked.
2. Wrong date on new times → NULL date link (primary blocker). Broken row op_shift_times.959655 has start_time = 2026-04-27 12:00 — the Day dropdown selection (Aug 23 PreSun) is NOT applied; a stale default date is used. handleTimeListAdd (types/index.ts) derives start_date_id/end_date_id via (SELECT date_id FROM op_dates WHERE date = DATE(start_time) ...); since 2026-04-27 isn't an event date, the lookup → NULL. Result: orphaned, date-less shift, excluded/mis-shown everywhere. Working rows have start_time = 2026-09-04 … with a real date_id.
3. Self-removal on re-save. Row 959655 also has remove_shift_time=1, shift_instance='959655' — the delete path ([typeId]/index.ts timeListRemove: sets remove=true, shift_instance=id). A newly-inserted time's id isn't reflected back into the form's timeList, so the next Update shift type treats it as "not in form → deleted" and removes it.
Fix scope: (a) apply the selected Day to start/end datetime (or look up date_id from the Day/datename, not DATE(start_time)); (b) feed new time ids back into the form after add so re-save doesn't delete them; (c) surface the save action. Confirms offline-create concern #111.
4th issue in this flow — Save silently disables with no reason.ShiftTypesUpdate.tsx:395: the Update shift type submit is disabled={Object.keys(errors).length > 0 || isMutating}. Any RHF validation error anywhere in the form (including a required field on a newly-added time/position row — Day, Instance, Position, Alias, Slots, SAP points) greys out Save with no summary of which field is invalid. User sees only a dead button. Reported by both Chipper and Rescue.
Fix: surface which field/row is invalid (scroll-to + message / error summary), don't just disable silently. Pairs with the hidden-save-button UX (issue #1 above).
Full flow now has 4 compounding defects: (1) save button below the fold, (2) wrong date on new times → NULL start_date_id, (3) self-removal of new times on re-save, (4) silent disable-on-invalid with no message.
5th issue — duplicate new-time rows share a key (edit one → both change). When you add a time, the form shows it twice and editing one edits both. Verified this is FRONT-END only (DB shows no duplicate — only the single orphan 959655 + the 6 originals). Cause: new/unsaved time rows have no unique id (timeId=0 until saved), so the RHF field array keys collide and React binds the two rows together. New times need a stable client-side key (e.g. RHF field id, or a client-generated uuid) at add time.
Running tally for the add-a-new-time flow: (1) save button below fold, (2) wrong date → NULL start_date_id, (3) self-removal on re-save, (4) silent disable-on-invalid with no message, (5) duplicate rows sharing a key. This whole path needs a rework + e2e coverage before playa (offline-create, #111).
Activity
fix(shift-types): Save no longer silently no-ops on an empty required…
mbhewitt commentedon Aug 15, 2026
Live prod repro (2026-08-15, Chipper) — fix #560/#528 does NOT cover this path.
Chipper added a new instance of the Tech Support shift type for Pre-event Sunday, clicked Save; it does not appear on the Shifts List. The row saved in a broken state:
op_shift_times.shift_times_id = 959655(shift_name_id 21 = Tech Support)start_date_id = NULL— never linked to the PreSun date (date_id 5)remove_shift_time = 1— flagged removed on creationop_shift_time_positionrow hasremove_time_position = 1→ 0 active positionsShifts List query excludes it (needs
remove_shift_time=falseAND an INNER join to a non-removedop_shift_time_position). Working Tech Support instances (Open Sun–Fri, ids 70–75) each have a date, remove=0, 1 active position.So adding a brand-new instance for a new date still silently fails to persist correctly (no date set, row + position left in the removed state) — distinct from the empty-required-field no-op fixed in #560. Also confirms the offline-server create concern (#111): broken online ⇒ broken offline.
mbhewitt commentedon Aug 15, 2026
Root cause (2026-08-15, prod data + code trace). Three compounding issues:
1. Hidden save button (UX). The Shift-Type editor is two-step: the dialog's Add time only stages the row in the form; nothing persists until Update shift type — a pink button at the very bottom of the page, below the footer/fold. Easy to miss entirely, so "I added a time and it vanished" often = the commit button never got clicked.
2. Wrong date on new times → NULL date link (primary blocker). Broken row
op_shift_times.959655hasstart_time = 2026-04-27 12:00— the Day dropdown selection (Aug 23 PreSun) is NOT applied; a stale default date is used.handleTimeListAdd(types/index.ts) derivesstart_date_id/end_date_idvia(SELECT date_id FROM op_dates WHERE date = DATE(start_time) ...); since 2026-04-27 isn't an event date, the lookup → NULL. Result: orphaned, date-less shift, excluded/mis-shown everywhere. Working rows havestart_time = 2026-09-04 …with a real date_id.3. Self-removal on re-save. Row 959655 also has
remove_shift_time=1, shift_instance='959655'— the delete path ([typeId]/index.tstimeListRemove: sets remove=true, shift_instance=id). A newly-inserted time's id isn't reflected back into the form'stimeList, so the next Update shift type treats it as "not in form → deleted" and removes it.Fix scope: (a) apply the selected Day to start/end datetime (or look up date_id from the Day/datename, not
DATE(start_time)); (b) feed new time ids back into the form after add so re-save doesn't delete them; (c) surface the save action. Confirms offline-create concern #111.mbhewitt commentedon Aug 15, 2026
4th issue in this flow — Save silently disables with no reason.
ShiftTypesUpdate.tsx:395: the Update shift type submit isdisabled={Object.keys(errors).length > 0 || isMutating}. Any RHF validation error anywhere in the form (including a required field on a newly-added time/position row — Day, Instance, Position, Alias, Slots, SAP points) greys out Save with no summary of which field is invalid. User sees only a dead button. Reported by both Chipper and Rescue.Fix: surface which field/row is invalid (scroll-to + message / error summary), don't just disable silently. Pairs with the hidden-save-button UX (issue #1 above).
Full flow now has 4 compounding defects: (1) save button below the fold, (2) wrong date on new times → NULL start_date_id, (3) self-removal of new times on re-save, (4) silent disable-on-invalid with no message.
mbhewitt commentedon Aug 15, 2026
5th issue — duplicate new-time rows share a key (edit one → both change). When you add a time, the form shows it twice and editing one edits both. Verified this is FRONT-END only (DB shows no duplicate — only the single orphan 959655 + the 6 originals). Cause: new/unsaved time rows have no unique id (timeId=0 until saved), so the RHF field array keys collide and React binds the two rows together. New times need a stable client-side key (e.g. RHF field
id, or a client-generated uuid) at add time.Running tally for the add-a-new-time flow: (1) save button below fold, (2) wrong date → NULL start_date_id, (3) self-removal on re-save, (4) silent disable-on-invalid with no message, (5) duplicate rows sharing a key. This whole path needs a rework + e2e coverage before playa (offline-create, #111).
fix(e2e,#533): reconcile 6 drifted specs + fix silent-save validation…
ci: run the full Playwright e2e suite + daily schedule (#666)
test(wip): mbhewitt#533 shift-type add-position repro (e2e)
test(wip): mbhewitt#533 repro via real super-admin login + BSA-gated …
Edit a shift from its page; reschedule notice (#901)
mbhewitt commentedon Nov 29, 2026
Shipped in PR #901 (prod 2027.G.00901.C, 2026-11-29). Migration 037 applied. Leaving this open for Mew to close.