fix(D8): grid slots render, per-cell optimistic revert, shared E2E helpers, admin reset endpoint
- src/db/grid.ts: key role map by ID (was slug, causing all cells to show '—') - src/components/app/schedule-grid-editor.tsx: revert only failed cell, not entire grid - src/db/audit.ts: fix import path ./db → @/db - src/db/seed.ts: add resetAndSeed(), assign Audio only (leave Livestream/Slides open) - src/auth/config.ts: carry id/email on JWT for audit actor - e2e/dev.ts: shared signInAs + resetDb helpers - e2e/schedule-grid.spec.ts: use shared helpers, reset DB beforeAll - e2e/assign-mutations.spec.ts: E2E for assign/clear with optimistic update + rollback - src/app/api/dev/reset/route.ts: admin-only DB reset endpoint - playwright.config.ts: workers: 1 (serial, suites share one Postgres)
This commit is contained in:
@@ -61,7 +61,13 @@ export function ScheduleGridEditor({
|
||||
// non-JSON body — fall through to the default message
|
||||
}
|
||||
if (!res.ok) {
|
||||
setDisplay(committed.current);
|
||||
// Revert only the cell that failed, leaving other optimistic changes intact
|
||||
const committedSlot = committed.current.instances
|
||||
.flatMap((i) => i.slots)
|
||||
.find((s) => s.id === payload.slotId);
|
||||
setDisplay((prev) =>
|
||||
withSlotAssignments(prev, payload.slotId, committedSlot?.assignments ?? []),
|
||||
);
|
||||
setToast({ message: error ?? "Could not save. Please try again.", kind: "error" });
|
||||
} else {
|
||||
committed.current = display;
|
||||
|
||||
Reference in New Issue
Block a user