@ai-matrx/records-ui 0.116.41 → 0.116.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1822,7 +1822,7 @@ declare function GridCell({ field, row, editing, canWrite, whyNot, format, onAsk
1822
1822
  declare function hintIsMachineIdentity(hint: string): boolean;
1823
1823
  /** The hint a PERSON should read, or null when it is written for an engineer. */
1824
1824
  declare function hintForAPerson(hint: string | null | undefined): string | null;
1825
- declare function RefusalNotice({ error, className, actions, onKeepEditing, onDiscard, }: {
1825
+ declare function RefusalNotice({ error, className, actions, onKeepEditing, onDiscard, onRetry, }: {
1826
1826
  error: RecordsError;
1827
1827
  className?: string | undefined;
1828
1828
  actions?: ReactNode | undefined;
@@ -1836,6 +1836,11 @@ declare function RefusalNotice({ error, className, actions, onKeepEditing, onDis
1836
1836
  */
1837
1837
  onKeepEditing?: (() => void) | undefined;
1838
1838
  onDiscard?: (() => void) | undefined;
1839
+ /**
1840
+ * TRY AGAIN (AT-SLOW-2, 2026-10-19): the press that failed, run again. Pass it where the refused act
1841
+ * is safe to repeat as it was (ViewNeeds reads the table first, so a declare that landed is never made twice).
1842
+ */
1843
+ onRetry?: (() => void) | undefined;
1839
1844
  }): react.JSX.Element;
1840
1845
  /** A small inline one, for a cell or a field where a block would break the layout. */
1841
1846
  declare function RefusalLine({ error, className }: {
package/dist/index.d.ts CHANGED
@@ -1822,7 +1822,7 @@ declare function GridCell({ field, row, editing, canWrite, whyNot, format, onAsk
1822
1822
  declare function hintIsMachineIdentity(hint: string): boolean;
1823
1823
  /** The hint a PERSON should read, or null when it is written for an engineer. */
1824
1824
  declare function hintForAPerson(hint: string | null | undefined): string | null;
1825
- declare function RefusalNotice({ error, className, actions, onKeepEditing, onDiscard, }: {
1825
+ declare function RefusalNotice({ error, className, actions, onKeepEditing, onDiscard, onRetry, }: {
1826
1826
  error: RecordsError;
1827
1827
  className?: string | undefined;
1828
1828
  actions?: ReactNode | undefined;
@@ -1836,6 +1836,11 @@ declare function RefusalNotice({ error, className, actions, onKeepEditing, onDis
1836
1836
  */
1837
1837
  onKeepEditing?: (() => void) | undefined;
1838
1838
  onDiscard?: (() => void) | undefined;
1839
+ /**
1840
+ * TRY AGAIN (AT-SLOW-2, 2026-10-19): the press that failed, run again. Pass it where the refused act
1841
+ * is safe to repeat as it was (ViewNeeds reads the table first, so a declare that landed is never made twice).
1842
+ */
1843
+ onRetry?: (() => void) | undefined;
1839
1844
  }): react.JSX.Element;
1840
1845
  /** A small inline one, for a cell or a field where a block would break the layout. */
1841
1846
  declare function RefusalLine({ error, className }: {
package/dist/index.js CHANGED
@@ -182,7 +182,7 @@ import {
182
182
  withoutAddition,
183
183
  withoutLeadingBlank,
184
184
  workedOutErrorFor
185
- } from "./chunk-JKM6DDSD.js";
185
+ } from "./chunk-THRMANHB.js";
186
186
  import {
187
187
  CHART_PLOT_PX,
188
188
  EMBEDDED_ROW_PX,
@@ -293,7 +293,7 @@ import {
293
293
  visibilityLaneFor,
294
294
  whyNotAskable,
295
295
  writeOnTheWinningVersion_exports
296
- } from "./chunk-U7SHCLTY.js";
296
+ } from "./chunk-OKAAPN6O.js";
297
297
  import {
298
298
  ACTION_CHECKING_ACCESS_REASON,
299
299
  ACTION_NOT_HERE_REASON,
@@ -400,7 +400,7 @@ import {
400
400
  useRowRights,
401
401
  useTableRights,
402
402
  withoutInternalCodes
403
- } from "./chunk-5IHVQ5MS.js";
403
+ } from "./chunk-KEILC5XG.js";
404
404
  import {
405
405
  FEWEST_KEY_VALUE_PAIRS,
406
406
  FEWEST_LIST_ITEMS,
@@ -23036,8 +23036,14 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
23036
23036
  const choices = options.map((o) => o.trim()).filter((o) => o !== "");
23037
23037
  const suggestion = need.ask(name, choices);
23038
23038
  const make = async () => {
23039
+ const retrying = refused !== null || mutation.error !== null;
23039
23040
  setRefused(null);
23040
- const made = pendingId ?? await mutation.declare({
23041
+ let already = null;
23042
+ if (retrying && !pendingId) {
23043
+ const now = await client.fields({ table_id: tableId });
23044
+ if (now.ok) already = now.data.find((f) => fieldName(f) === name && !fields.some((g) => g.id === f.id))?.id ?? null;
23045
+ }
23046
+ const made = pendingId ?? already ?? await mutation.declare({
23041
23047
  table_id: tableId,
23042
23048
  spec: columnDeclarationFor(need, name, choices, fields)
23043
23049
  });
@@ -23117,8 +23123,8 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
23117
23123
  children: rights.structure ? `${need.missing} ${need.does(name)}` : need.missing
23118
23124
  }
23119
23125
  ),
23120
- mutation.error ? /* @__PURE__ */ jsx77(RefusalNotice, { error: mutation.error }) : null,
23121
- refused ? /* @__PURE__ */ jsx77(RefusalNotice, { error: refused }) : null,
23126
+ mutation.error ? /* @__PURE__ */ jsx77(RefusalNotice, { error: mutation.error, onRetry: rights.structure ? () => void make() : void 0 }) : null,
23127
+ refused ? /* @__PURE__ */ jsx77(RefusalNotice, { error: refused, onRetry: rights.structure ? () => void make() : void 0 }) : null,
23122
23128
  pendingId ? /* @__PURE__ */ jsx77("p", { className: "mt-2 text-xs text-muted-foreground", children: "The column was accepted but the table does not show it yet. Press Make it work again to look for it \u2014 it will not be added twice." }) : null
23123
23129
  ] });
23124
23130
  }
@@ -36305,6 +36311,9 @@ function CsvButton({ name, fields, rows }) {
36305
36311
  if (rows.length === 0) return null;
36306
36312
  return /* @__PURE__ */ jsx114(Button86, { size: "sm", variant: "ghost", className: "h-7 text-xs", onClick: () => downloadCsv(name, fields, rows), "data-records-page-csv": "", children: "CSV" });
36307
36313
  }
36314
+ function sameRows(had, rows) {
36315
+ return had === rows || had !== void 0 && had.length === 0 && rows.length === 0;
36316
+ }
36308
36317
  function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEdit, onSave, onChart }) {
36309
36318
  const [selected, setSelected] = useState103({});
36310
36319
  const [listRows, setListRows] = useState103({});
@@ -36352,7 +36361,7 @@ function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEd
36352
36361
  viewerUserId,
36353
36362
  selected,
36354
36363
  onSelect: (listId, recordId) => setSelected((s) => ({ ...s, [listId]: recordId })),
36355
- onRows: (listId, rows) => setListRows((r) => r[listId] === rows ? r : { ...r, [listId]: rows }),
36364
+ onRows: (listId, rows) => setListRows((r) => sameRows(r[listId], rows) ? r : { ...r, [listId]: rows }),
36356
36365
  listRows,
36357
36366
  listOf,
36358
36367
  extraFor: filtersFor,
@@ -36544,6 +36553,7 @@ var DEFAULT_COLUMNS = 4;
36544
36553
  function shownColumns(all, columns) {
36545
36554
  return columns && columns.length > 0 ? columns.map((k) => all.find((f) => f.key === k)).filter((f) => !!f) : [...all].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100)).slice(0, DEFAULT_COLUMNS);
36546
36555
  }
36556
+ var NO_ROWS3 = [];
36547
36557
  function useElementRows(block, viewerUserId, extra, mineOn) {
36548
36558
  const door = useInterfaceDoor();
36549
36559
  const member = useMemberRows(block, viewerUserId, extra, mineOn, !door);
@@ -36564,7 +36574,7 @@ function useElementRows(block, viewerUserId, extra, mineOn) {
36564
36574
  }
36565
36575
  const { q, page } = member;
36566
36576
  return {
36567
- rows: q.nobodyIsMe ? [] : page.data?.rows ?? [],
36577
+ rows: q.nobodyIsMe ? NO_ROWS3 : page.data?.rows ?? NO_ROWS3,
36568
36578
  all: q.all,
36569
36579
  total: q.nobodyIsMe ? 0 : page.data?.total ?? null,
36570
36580
  loading: page.loading,