Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- web/src/customer-grid/CustomerGrid.tsx +40 -1
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v13",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "2418c83",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v13",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
2418c83
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
@@ -1368,11 +1368,25 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
|
|
| 1368 |
// taken, and it reads the store to do it β firing ten restores concurrently is ten
|
| 1369 |
// readers racing one counter, which is how two rows end up sharing an id.
|
| 1370 |
let any = false;
|
|
|
|
| 1371 |
for (const r of op.rows) {
|
| 1372 |
const made = await addTableRow(op.table, r.values as Record<string, unknown>, r.rid);
|
| 1373 |
any = any || !!made; // a refusal already said why, in the server's words
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1374 |
}
|
| 1375 |
if (!any) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1376 |
signal(ROWS_STALE_EVENT);
|
| 1377 |
} else if (op.kind === "rowDelete") {
|
| 1378 |
let any = false;
|
|
@@ -1475,9 +1489,25 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
|
|
| 1475 |
for (const vr of displayRows)
|
| 1476 |
if (vr.kind === "data") byPid.set(vr.record.pid, vr.record);
|
| 1477 |
const captured: UndoRow[] = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1478 |
for (const pid of pids) {
|
| 1479 |
const rec = byPid.get(pid);
|
| 1480 |
-
if (!rec)
|
|
|
|
|
|
|
|
|
|
| 1481 |
const values: Record<string, UndoValue> = {};
|
| 1482 |
for (const f of fields) {
|
| 1483 |
const v = rec[f.key];
|
|
@@ -1486,6 +1516,15 @@ function CustomerGrid({ scope = "customer" }: { scope?: SurfaceScope } = {}) {
|
|
| 1486 |
}
|
| 1487 |
captured.push({ rid: pid, values });
|
| 1488 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1489 |
if (!captured.length) return false;
|
| 1490 |
// SEQUENTIAL, matching the restore path: the store is one document and ten concurrent
|
| 1491 |
// read-modify-writes against it is how a delete silently misses a row.
|
|
|
|
| 1368 |
// taken, and it reads the store to do it β firing ten restores concurrently is ten
|
| 1369 |
// readers racing one counter, which is how two rows end up sharing an id.
|
| 1370 |
let any = false;
|
| 1371 |
+
let moved = 0;
|
| 1372 |
for (const r of op.rows) {
|
| 1373 |
const made = await addTableRow(op.table, r.values as Record<string, unknown>, r.rid);
|
| 1374 |
any = any || !!made; // a refusal already said why, in the server's words
|
| 1375 |
+
// β THE ID IS PART OF WHAT IS BEING UNDONE, and `add_row` falls back to `max(id)+1`
|
| 1376 |
+
// when the one it was asked for is no longer free β which happens if anything created
|
| 1377 |
+
// a row in the gap. The restore is still the right thing to do, but it is no longer
|
| 1378 |
+
// the SAME record to anything that named the old id (a cohort, a comment, a filter),
|
| 1379 |
+
// and a redo would then look for an id that is not there. Said out loud rather than
|
| 1380 |
+
// discovered later.
|
| 1381 |
+
if (made && String(made.rid) !== String(r.rid)) moved += 1;
|
| 1382 |
}
|
| 1383 |
if (!any) return;
|
| 1384 |
+
if (moved)
|
| 1385 |
+
signal(
|
| 1386 |
+
TOAST_EVENT,
|
| 1387 |
+
`${moved} restored record${moved === 1 ? "" : "s"} came back under a new id β ` +
|
| 1388 |
+
`something had taken the original while it was gone.`
|
| 1389 |
+
);
|
| 1390 |
signal(ROWS_STALE_EVENT);
|
| 1391 |
} else if (op.kind === "rowDelete") {
|
| 1392 |
let any = false;
|
|
|
|
| 1489 |
for (const vr of displayRows)
|
| 1490 |
if (vr.kind === "data") byPid.set(vr.record.pid, vr.record);
|
| 1491 |
const captured: UndoRow[] = [];
|
| 1492 |
+
/*
|
| 1493 |
+
* β A SKIPPED ROW IS COUNTED AND NAMED, never dropped quietly ([[no-unverifiable-aggregates]]).
|
| 1494 |
+
* `displayRows` is FILTERED and CAPPED, and the selection is not: Select-from-file matches
|
| 1495 |
+
* on a value and can tick pids the current view does not render β `fileSelect` has a whole
|
| 1496 |
+
* bucket for exactly that ("not in this view"). Capturing only what is on screen and
|
| 1497 |
+
* `continue`ing past the rest would delete two rows and report three, which is the silent-cap
|
| 1498 |
+
* defect in the one place it is least forgivable.
|
| 1499 |
+
*
|
| 1500 |
+
* REFUSED WHOLE rather than partially applied: a delete that half-happened leaves the reader
|
| 1501 |
+
* reconciling a count against a table, and the fix (scroll or clear the filter, then select
|
| 1502 |
+
* again) is one sentence away.
|
| 1503 |
+
*/
|
| 1504 |
+
const offscreen: number[] = [];
|
| 1505 |
for (const pid of pids) {
|
| 1506 |
const rec = byPid.get(pid);
|
| 1507 |
+
if (!rec) {
|
| 1508 |
+
offscreen.push(pid);
|
| 1509 |
+
continue;
|
| 1510 |
+
}
|
| 1511 |
const values: Record<string, UndoValue> = {};
|
| 1512 |
for (const f of fields) {
|
| 1513 |
const v = rec[f.key];
|
|
|
|
| 1516 |
}
|
| 1517 |
captured.push({ rid: pid, values });
|
| 1518 |
}
|
| 1519 |
+
if (offscreen.length) {
|
| 1520 |
+
signal(
|
| 1521 |
+
TOAST_EVENT,
|
| 1522 |
+
`Nothing was deleted β ${offscreen.length} of the ${pids.length} selected ` +
|
| 1523 |
+
`record${pids.length === 1 ? " is" : "s are"} not shown in this view. Clear the ` +
|
| 1524 |
+
`filter (or scroll them into view) and select again.`
|
| 1525 |
+
);
|
| 1526 |
+
return false;
|
| 1527 |
+
}
|
| 1528 |
if (!captured.length) return false;
|
| 1529 |
// SEQUENTIAL, matching the restore path: the store is one document and ten concurrent
|
| 1530 |
// read-modify-writes against it is how a delete silently misses a row.
|