@ai-matrx/records-ui 0.116.56 → 0.116.57

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
@@ -5915,7 +5915,7 @@ interface PageCanvasProps {
5915
5915
  /** Called with a chart edited in settings (an Interface copies a published chart before changing it). */
5916
5916
  onChart?: ((chart: ChartSpec) => void) | undefined;
5917
5917
  }
5918
- declare function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEdit, onSave, onChart }: PageCanvasProps): react.JSX.Element;
5918
+ declare function PageCanvas(props: PageCanvasProps): react.JSX.Element;
5919
5919
 
5920
5920
  interface InterfaceScreenProps {
5921
5921
  interfaceId?: Uuid$1 | null | undefined;
package/dist/index.d.ts CHANGED
@@ -5915,7 +5915,7 @@ interface PageCanvasProps {
5915
5915
  /** Called with a chart edited in settings (an Interface copies a published chart before changing it). */
5916
5916
  onChart?: ((chart: ChartSpec) => void) | undefined;
5917
5917
  }
5918
- declare function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEdit, onSave, onChart }: PageCanvasProps): react.JSX.Element;
5918
+ declare function PageCanvas(props: PageCanvasProps): react.JSX.Element;
5919
5919
 
5920
5920
  interface InterfaceScreenProps {
5921
5921
  interfaceId?: Uuid$1 | null | undefined;
package/dist/index.js CHANGED
@@ -182,7 +182,7 @@ import {
182
182
  withoutAddition,
183
183
  withoutLeadingBlank,
184
184
  workedOutErrorFor
185
- } from "./chunk-GZJ7GRM2.js";
185
+ } from "./chunk-F3NGOSYY.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-BZ6PLCAR.js";
296
+ } from "./chunk-Y6U5OFJX.js";
297
297
  import {
298
298
  ACTION_CHECKING_ACCESS_REASON,
299
299
  ACTION_NOT_HERE_REASON,
@@ -346,6 +346,7 @@ import {
346
346
  PickOrAdd,
347
347
  ROLLUP_AGG_LABEL,
348
348
  ROLLUP_AGG_VALUES,
349
+ ReadRefusalDock,
349
350
  RecordsUiProvider,
350
351
  RefusalLine,
351
352
  RefusalNotice,
@@ -364,6 +365,7 @@ import {
364
365
  WORK_INBOX_KIND_GROUP_LABEL,
365
366
  WORK_INBOX_KIND_LABEL,
366
367
  addFields,
368
+ askWithOneRetry,
367
369
  cardTitleField,
368
370
  changedRecordName,
369
371
  choiceNudgeOf,
@@ -397,12 +399,14 @@ import {
397
399
  tokenFor,
398
400
  useChoiceNudge,
399
401
  usePickerTables,
402
+ useReadAgain,
403
+ useReadRefusal,
400
404
  useRecordRights,
401
405
  useRecordsUi,
402
406
  useRowRights,
403
407
  useTableRights,
404
408
  withoutInternalCodes
405
- } from "./chunk-7LELV7UI.js";
409
+ } from "./chunk-NGOPU3AJ.js";
406
410
  import {
407
411
  FEWEST_KEY_VALUE_PAIRS,
408
412
  FEWEST_LIST_ITEMS,
@@ -2568,11 +2572,13 @@ import { useRecordsClient as useRecordsClient5 } from "@ai-matrx/records/react";
2568
2572
  function useWholeTableCount(args) {
2569
2573
  const client = useRecordsClient5();
2570
2574
  const [count, setCount] = useState5(null);
2575
+ const reads = useReadRefusal("record_aggregate");
2576
+ const [attempt, again] = useReadAgain();
2571
2577
  useEffect6(() => {
2572
2578
  if (!args.needed) return;
2573
2579
  let live = true;
2574
- void client.recordAggregate({ table_id: args.tableId, measures: [{ op: "count" }] }).then((answer) => {
2575
- if (!live || !answer.ok) return;
2580
+ void askWithOneRetry(() => client.recordAggregate({ table_id: args.tableId, measures: [{ op: "count" }] })).then((answer) => {
2581
+ if (!live || !reads.take(answer, again)) return;
2576
2582
  const row = answer.data?.[0];
2577
2583
  const n = Number(row?.measures?.["count"] ?? row?.row_count);
2578
2584
  setCount(Number.isFinite(n) ? { tableId: args.tableId, n } : null);
@@ -2580,7 +2586,7 @@ function useWholeTableCount(args) {
2580
2586
  return () => {
2581
2587
  live = false;
2582
2588
  };
2583
- }, [client, args.tableId, args.needed, args.version]);
2589
+ }, [client, args.tableId, args.needed, args.version, attempt]);
2584
2590
  return args.needed && count && count.tableId === args.tableId ? count.n : null;
2585
2591
  }
2586
2592
 
@@ -2606,6 +2612,8 @@ function useTableDecorations(tableId, revision) {
2606
2612
  const [state, setState] = useState6({ data: null, loading: Boolean(tableId) });
2607
2613
  const seen = useRef5({ tableId: void 0, revision: void 0 });
2608
2614
  const ticket = useRef5(0);
2615
+ const reads = useReadRefusal("table_decorations");
2616
+ const [attempt, again] = useReadAgain();
2609
2617
  useEffect7(() => {
2610
2618
  if (!tableId) {
2611
2619
  ticket.current += 1;
@@ -2620,11 +2628,12 @@ function useTableDecorations(tableId, revision) {
2620
2628
  }
2621
2629
  const mine = ticket.current += 1;
2622
2630
  setState((held) => ({ data: held.data, loading: true }));
2623
- void client.tableDecorations({ table_id: tableId }).then((result) => {
2631
+ void askWithOneRetry(() => client.tableDecorations({ table_id: tableId })).then((result) => {
2624
2632
  if (mine !== ticket.current) return;
2625
- setState({ data: result.ok ? result.data : null, loading: false });
2633
+ if (!reads.take(result, again)) return setState((held) => ({ data: held.data, loading: false }));
2634
+ setState({ data: result.data, loading: false });
2626
2635
  });
2627
- }, [client, tableId, revision]);
2636
+ }, [client, tableId, revision, attempt]);
2628
2637
  useEffect7(() => () => {
2629
2638
  ticket.current += 1;
2630
2639
  }, []);
@@ -4450,17 +4459,32 @@ function useChoiceOptions(fields, keys) {
4450
4459
  const client = useRecordsClient13();
4451
4460
  const [index, setIndex] = useState14(() => /* @__PURE__ */ new Map());
4452
4461
  const wantedKey = keys.join("\0");
4462
+ const reads = useReadRefusal("field_options");
4463
+ const [attempt, again] = useReadAgain();
4453
4464
  useEffect11(() => {
4454
4465
  const missing = keys.map((key) => fields.find((f) => f.key === key)).filter((f) => f !== void 0 && !index.has(f.key));
4455
4466
  if (missing.length === 0) return;
4456
4467
  let cancelled = false;
4457
4468
  void Promise.all(
4458
4469
  missing.map(async (field) => {
4459
- const got = await (0, askOnce_exports.fieldOptionsOnce)(client, field.id);
4460
- return [field.key, got.ok ? (got.data ?? []).map(lookOf) : null];
4470
+ const got = await askWithOneRetry(() => (0, askOnce_exports.fieldOptionsOnce)(client, field.id));
4471
+ return [field.key, got];
4461
4472
  })
4462
- ).then((answers) => {
4473
+ ).then((pairs) => {
4463
4474
  if (cancelled) return;
4475
+ const refused = pairs.find(([, got]) => !got.ok);
4476
+ const refusedKeys = pairs.filter(([, got]) => !got.ok).map(([key]) => key);
4477
+ const askAgain = () => {
4478
+ setIndex((held) => {
4479
+ const next = new Map(held);
4480
+ for (const key of refusedKeys) next.delete(key);
4481
+ return next;
4482
+ });
4483
+ again();
4484
+ };
4485
+ if (refused) reads.take(refused[1], askAgain);
4486
+ else reads.take({ ok: true, data: null }, askAgain);
4487
+ const answers = pairs.map(([key, got]) => [key, got.ok ? (got.data ?? []).map(lookOf) : null]);
4464
4488
  setIndex((held) => {
4465
4489
  const next = new Map(held);
4466
4490
  for (const [key, looks] of answers) next.set(key, looks ?? []);
@@ -4470,7 +4494,7 @@ function useChoiceOptions(fields, keys) {
4470
4494
  return () => {
4471
4495
  cancelled = true;
4472
4496
  };
4473
- }, [client, wantedKey, fields]);
4497
+ }, [client, wantedKey, fields, attempt]);
4474
4498
  return index;
4475
4499
  }
4476
4500
  function lookOf(option) {
@@ -5018,20 +5042,23 @@ function useFormulaReadings(tableId, formulas) {
5018
5042
  const client = useRecordsClient14();
5019
5043
  const [readings, setReadings] = useState15({});
5020
5044
  const key = formulas.join("\0");
5045
+ const reads = useReadRefusal("formula_parse");
5046
+ const [attempt, again] = useReadAgain();
5021
5047
  useEffect12(() => {
5022
5048
  if (!tableId) return;
5023
5049
  let live = true;
5024
5050
  for (const text of formulas) {
5025
5051
  if (!text.trim() || text in readings) continue;
5026
- void client.formulaParse({ table_id: tableId, text }).then((answer) => {
5052
+ void askWithOneRetry(() => client.formulaParse({ table_id: tableId, text })).then((answer) => {
5027
5053
  if (!live) return;
5028
- setReadings((was) => ({ ...was, [text]: answer.ok ? answer.data : null }));
5054
+ if (!reads.take(answer, again)) return;
5055
+ setReadings((was) => ({ ...was, [text]: answer.data }));
5029
5056
  });
5030
5057
  }
5031
5058
  return () => {
5032
5059
  live = false;
5033
5060
  };
5034
- }, [client, tableId, key]);
5061
+ }, [client, tableId, key, attempt]);
5035
5062
  return readings;
5036
5063
  }
5037
5064
  function ActionRowPreview({
@@ -6048,14 +6075,17 @@ function useColumnSummaries(args) {
6048
6075
  };
6049
6076
  }, [client, tableId, chosenKey, filterKey, version]);
6050
6077
  const asking = useRef8(false);
6051
- const askOperations = useCallback10(() => {
6052
- if (operations !== null || asking.current) return;
6078
+ const operationReads = useReadRefusal("agg_operations");
6079
+ const operationsAsked = useRef8(() => void 0);
6080
+ operationsAsked.current = (force) => {
6081
+ if (!force && operations !== null || asking.current) return;
6053
6082
  asking.current = true;
6054
- void client.aggOperations().then((answered) => {
6083
+ void askWithOneRetry(() => client.aggOperations()).then((answered) => {
6055
6084
  asking.current = false;
6056
- setOperations(answered.ok ? answered.data ?? [] : []);
6085
+ setOperations(operationReads.take(answered, () => operationsAsked.current(true)) ? answered.data ?? [] : []);
6057
6086
  });
6058
- }, [client, operations]);
6087
+ };
6088
+ const askOperations = useCallback10(() => operationsAsked.current(false), []);
6059
6089
  return { values, withheld, rowCount, loading, error, operations, askOperations };
6060
6090
  }
6061
6091
  function withSummaryCells(columns, render) {
@@ -6822,6 +6852,8 @@ function useMergedGridControls(args) {
6822
6852
  const choiceKeys = useMemo13(() => enabled ? fields.filter(isChoiceField).map((f) => f.key) : [], [enabled, fields]);
6823
6853
  const choiceOptions = useChoiceOptions(fields, choiceKeys);
6824
6854
  const searchWords = (args.search ?? "").trim();
6855
+ const countReads = useReadRefusal("value_counts");
6856
+ const [countAttempt, countAgain] = useReadAgain();
6825
6857
  const countQuestionKey = JSON.stringify([choiceKeys, query.columnFilters, args.filter ?? null, searchWords]);
6826
6858
  const rowsKey = rows.map((row) => `${row.id}:${row.version ?? ""}`).join(",");
6827
6859
  const fieldsRef = useRef9(fields);
@@ -6844,7 +6876,7 @@ function useMergedGridControls(args) {
6844
6876
  () => client.recordAggregate({ table_id: tableId, groupBy: [key], measures: [{ op: "count" }], ...asked2.filter ? { filter: asked2.filter } : {}, ...searched ? { search: searched } : {}, limit: 500 }),
6845
6877
  VALUE_COUNTS_FRESH_MS
6846
6878
  ).then((answer) => {
6847
- if (cancelled || !answer.ok) return;
6879
+ if (cancelled || !countReads.take(answer, countAgain)) return;
6848
6880
  const counted = /* @__PURE__ */ new Map();
6849
6881
  for (const row of answer.data ?? []) {
6850
6882
  const value = row.groups?.[key];
@@ -6857,7 +6889,7 @@ function useMergedGridControls(args) {
6857
6889
  return () => {
6858
6890
  cancelled = true;
6859
6891
  };
6860
- }, [enabled, countQuestionKey, client, tableId, rowsKey]);
6892
+ }, [enabled, countQuestionKey, client, tableId, rowsKey, countAttempt]);
6861
6893
  const filterFor = useCallback12(
6862
6894
  (key) => {
6863
6895
  if (!enabled) return void 0;
@@ -8504,14 +8536,16 @@ function useAddedRows(args) {
8504
8536
  }, [pageKey, tableId]);
8505
8537
  const pinnedKey = added.map((r) => r.id).join(",");
8506
8538
  const asked2 = useRef12(0);
8539
+ const reads = useReadRefusal("list_by_ids");
8540
+ const [attempt, again] = useReadAgain();
8507
8541
  useEffect22(() => {
8508
8542
  if (!enabled || added.length === 0) return;
8509
8543
  const onPage = new Set(pageRows.map((r) => r.id));
8510
8544
  const missing = added.filter((r) => !onPage.has(r.id)).map((r) => r.id);
8511
8545
  if (missing.length === 0) return;
8512
8546
  const ticket = asked2.current += 1;
8513
- void client.listByIds({ table_id: tableId, ids: missing }).then((answer) => {
8514
- if (ticket !== asked2.current || !answer.ok) return;
8547
+ void askWithOneRetry(() => client.listByIds({ table_id: tableId, ids: missing })).then((answer) => {
8548
+ if (ticket !== asked2.current || !reads.take(answer, again)) return;
8515
8549
  const fresh = new Map(answer.data.map((r) => [r.id, r]));
8516
8550
  setAdded(
8517
8551
  (held) => held.flatMap((row) => {
@@ -8521,7 +8555,7 @@ function useAddedRows(args) {
8521
8555
  })
8522
8556
  );
8523
8557
  });
8524
- }, [enabled, pageRows, pinnedKey, client, tableId]);
8558
+ }, [enabled, pageRows, pinnedKey, client, tableId, attempt]);
8525
8559
  const rows = useMemo16(() => enabled ? placePinnedRows(pageRows, added, anchors) : pageRows, [enabled, pageRows, added, anchors]);
8526
8560
  const pin = useCallback13((row, after) => {
8527
8561
  setAdded((held) => held.some((r) => r.id === row.id) ? held : [...held, row]);
@@ -12278,17 +12312,19 @@ function useStructureHidden(tableId, level) {
12278
12312
  const client = useRecordsClient33();
12279
12313
  const asks = tableId !== null && mayHideStructure(level);
12280
12314
  const [answer, setAnswer] = useState40(null);
12315
+ const reads = useReadRefusal("table_level_facts");
12316
+ const [attempt, again] = useReadAgain();
12281
12317
  useEffect34(() => {
12282
12318
  if (!asks || tableId === null) return;
12283
12319
  let live = true;
12284
- void client.tableLevelFacts({ table_id: tableId }).then((facts) => {
12320
+ void askWithOneRetry(() => client.tableLevelFacts({ table_id: tableId })).then((facts) => {
12285
12321
  if (!live) return;
12286
- setAnswer({ tableId, hidden: facts.ok && facts.data.structure_hidden === true });
12322
+ setAnswer({ tableId, hidden: reads.take(facts, again) && facts.data.structure_hidden === true });
12287
12323
  });
12288
12324
  return () => {
12289
12325
  live = false;
12290
12326
  };
12291
- }, [client, tableId, asks]);
12327
+ }, [client, tableId, asks, attempt]);
12292
12328
  if (!asks) return { settled: true, hidden: false };
12293
12329
  const mine = answer !== null && answer.tableId === tableId ? answer : null;
12294
12330
  return { settled: mine !== null, hidden: mine?.hidden ?? false };
@@ -24142,12 +24178,14 @@ function useLinkGroupNamer(block, tableId) {
24142
24178
  const [named, setNamed] = useState74({});
24143
24179
  const [choices, setChoices] = useState74([]);
24144
24180
  const labels = useRecordLabels(choices);
24181
+ const reads = useReadRefusal("fields_and_relation_words");
24182
+ const [attempt, again] = useReadAgain();
24145
24183
  useEffect65(() => {
24146
24184
  if (!client || groupBy.length === 0 || rows.length === 0) return;
24147
24185
  let cancelled = false;
24148
24186
  void (async () => {
24149
- const fields = await client.fields({ table_id: tableId });
24150
- if (!fields.ok || cancelled) return;
24187
+ const fields = await askWithOneRetry(() => client.fields({ table_id: tableId }));
24188
+ if (cancelled || !reads.take(fields, again)) return;
24151
24189
  const grouped = groupBy.map((key) => fields.data.find((f) => f.key === key)).filter((f) => !!f && f.type === "list" && editorKindFor(f) !== "relation");
24152
24190
  if (grouped.length > 0) setChoices(grouped);
24153
24191
  const links = groupBy.map((key) => fields.data.find((f) => f.key === key)).filter((f) => !!f && editorKindFor(f) === "relation");
@@ -24159,17 +24197,20 @@ function useLinkGroupNamer(block, tableId) {
24159
24197
  const v = r.groups?.[field.key];
24160
24198
  return typeof v === "string" ? linkIdsOf(v) : [];
24161
24199
  }))];
24162
- if (ids.length === 0) return [field.key, { words: {}, done: true }];
24163
- const words2 = await client.relationWordsMany({ field_id: field.id, record_ids: ids });
24164
- return [field.key, { words: words2.ok ? words2.data : {}, done: true }];
24200
+ if (ids.length === 0) return [field.key, { ok: true, data: {} }, { words: {}, done: true }];
24201
+ const words2 = await askWithOneRetry(() => client.relationWordsMany({ field_id: field.id, record_ids: ids }));
24202
+ return [field.key, words2, { words: words2.ok ? words2.data : {}, done: true }];
24165
24203
  })
24166
24204
  );
24167
- if (!cancelled) setNamed(Object.fromEntries(answered));
24205
+ if (cancelled) return;
24206
+ const refused = answered.find(([, got]) => !got.ok);
24207
+ if (refused) reads.take(refused[1], again);
24208
+ setNamed(Object.fromEntries(answered.map(([key, , column]) => [key, column])));
24168
24209
  })();
24169
24210
  return () => {
24170
24211
  cancelled = true;
24171
24212
  };
24172
- }, [client, ask2]);
24213
+ }, [client, ask2, attempt]);
24173
24214
  return useMemo46(() => {
24174
24215
  if (Object.keys(named).length === 0 && choices.length === 0) return void 0;
24175
24216
  return (key, value) => {
@@ -26376,6 +26417,8 @@ function useFarFields(all) {
26376
26417
  const client = useRecordsClient63();
26377
26418
  const targets = lookupTargets(all).sort().join(",");
26378
26419
  const [far, setFar] = useState81(() => /* @__PURE__ */ new Map());
26420
+ const reads = useReadRefusal("fields");
26421
+ const [attempt, again] = useReadAgain();
26379
26422
  useEffect72(() => {
26380
26423
  let cancelled = false;
26381
26424
  const ids = targets ? targets.split(",") : [];
@@ -26383,14 +26426,17 @@ function useFarFields(all) {
26383
26426
  setFar(/* @__PURE__ */ new Map());
26384
26427
  return;
26385
26428
  }
26386
- void Promise.all(ids.map(async (id) => [id, await client.fields({ table_id: id })])).then((answers) => {
26429
+ void Promise.all(ids.map(async (id) => [id, await askWithOneRetry(() => client.fields({ table_id: id }))])).then((answers) => {
26387
26430
  if (cancelled) return;
26431
+ const refused = answers.find(([, r]) => !r.ok);
26432
+ if (refused) reads.take(refused[1], again);
26433
+ else reads.take({ ok: true, data: null }, again);
26388
26434
  setFar(new Map(answers.flatMap(([id, r]) => r.ok ? [[id, r.data]] : [])));
26389
26435
  });
26390
26436
  return () => {
26391
26437
  cancelled = true;
26392
26438
  };
26393
- }, [client, targets]);
26439
+ }, [client, targets, attempt]);
26394
26440
  return far;
26395
26441
  }
26396
26442
  function offerableFields(all, want, placing) {
@@ -26415,17 +26461,20 @@ function useStageField(tableId) {
26415
26461
  asked: false,
26416
26462
  key: null
26417
26463
  });
26464
+ const reads = useReadRefusal("table_stage_field");
26465
+ const [attempt, again] = useReadAgain();
26418
26466
  useEffect72(() => {
26419
26467
  let cancelled = false;
26420
26468
  setStage({ asked: false, key: null });
26421
- void client.tableStageField({ table_id: tableId }).then((r) => {
26469
+ void askWithOneRetry(() => client.tableStageField({ table_id: tableId })).then((r) => {
26422
26470
  if (cancelled) return;
26423
- setStage({ asked: true, key: r.ok ? r.data ?? null : null });
26471
+ if (!reads.take(r, again)) return;
26472
+ setStage({ asked: true, key: r.data ?? null });
26424
26473
  });
26425
26474
  return () => {
26426
26475
  cancelled = true;
26427
26476
  };
26428
- }, [client, tableId]);
26477
+ }, [client, tableId, attempt]);
26429
26478
  return stage;
26430
26479
  }
26431
26480
  function boardColumnChoice(fields, chosenKey, stage) {
@@ -36332,20 +36381,25 @@ function useNames(tableId, ids) {
36332
36381
  const [names, setNames] = useState103({});
36333
36382
  const titleField = table.data?.title_field ?? null;
36334
36383
  const key = ids.join("|");
36384
+ const reads = useReadRefusal("record_read");
36385
+ const [attempt, again] = useReadAgain();
36335
36386
  useEffect92(() => {
36336
36387
  let live = true;
36337
- void Promise.all(
36338
- ids.map(async (id) => {
36339
- const got = await client.recordRead({ record_id: id });
36340
- return [id, got.ok ? recordName(got.data.document, titleField, "Untitled") : "Untitled"];
36341
- })
36342
- ).then((pairs) => {
36343
- if (live) setNames(Object.fromEntries(pairs));
36388
+ void Promise.all(ids.map(async (id) => [id, await askWithOneRetry(() => client.recordRead({ record_id: id }))])).then((pairs) => {
36389
+ if (!live) return;
36390
+ const refused = pairs.find(([, got]) => !got.ok);
36391
+ if (refused) reads.take(refused[1], again);
36392
+ else reads.take({ ok: true, data: null }, again);
36393
+ setNames(
36394
+ Object.fromEntries(
36395
+ pairs.flatMap(([id, got]) => got.ok ? [[id, recordName(got.data.document, titleField, "Untitled")]] : [])
36396
+ )
36397
+ );
36344
36398
  });
36345
36399
  return () => {
36346
36400
  live = false;
36347
36401
  };
36348
- }, [client, key, titleField]);
36402
+ }, [client, key, titleField, attempt]);
36349
36403
  return names;
36350
36404
  }
36351
36405
  function AgentAnswer({
@@ -36521,7 +36575,13 @@ function CsvButton({ name, fields, rows }) {
36521
36575
  function sameRows(had, rows) {
36522
36576
  return had === rows || had !== void 0 && had.length === 0 && rows.length === 0;
36523
36577
  }
36524
- function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEdit, onSave, onChart }) {
36578
+ function PageCanvas(props) {
36579
+ return /* @__PURE__ */ jsxs108(Fragment50, { children: [
36580
+ /* @__PURE__ */ jsx115(PageCanvasBody, { ...props }),
36581
+ /* @__PURE__ */ jsx115(ReadRefusalDock, {})
36582
+ ] });
36583
+ }
36584
+ function PageCanvasBody({ blocks, charts, run, subject, viewerUserId, editing, canEdit, onSave, onChart }) {
36525
36585
  const [selected, setSelected] = useState104({});
36526
36586
  const [listRows, setListRows] = useState104({});
36527
36587
  const [filterValues, setFilterValues] = useState104({});
@@ -36600,6 +36660,10 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
36600
36660
  const fields = useFields31(enabled ? block.table_id : null);
36601
36661
  const all = useMemo64(() => onePerKey3(fields.data ?? []), [fields.data]);
36602
36662
  const [view, setView] = useState104(block.view_id ? "reading" : null);
36663
+ const viewReads = useReadRefusal("views");
36664
+ const [viewAttempt, viewAgain] = useReadAgain();
36665
+ const meReads = useReadRefusal("me_record");
36666
+ const [meAttempt, meAgain] = useReadAgain();
36603
36667
  useEffect93(() => {
36604
36668
  if (!block.view_id || !enabled) {
36605
36669
  setView(null);
@@ -36607,15 +36671,16 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
36607
36671
  }
36608
36672
  let live = true;
36609
36673
  setView("reading");
36610
- void client.views({ table_id: block.table_id }).then((answered) => {
36674
+ void askWithOneRetry(() => client.views({ table_id: block.table_id })).then((answered) => {
36611
36675
  if (!live) return;
36612
- const row = answered.ok ? answered.data.find((v) => v.view_id === block.view_id) : void 0;
36676
+ if (!viewReads.take(answered, viewAgain)) return setView(null);
36677
+ const row = answered.data.find((v) => v.view_id === block.view_id);
36613
36678
  setView(row ? viewFromRow(row) : null);
36614
36679
  });
36615
36680
  return () => {
36616
36681
  live = false;
36617
36682
  };
36618
- }, [client, block.table_id, block.view_id, enabled]);
36683
+ }, [client, block.table_id, block.view_id, enabled, viewAttempt]);
36619
36684
  const mine = mineOn || block.me_only === true;
36620
36685
  const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
36621
36686
  const [me, setMe] = useState104(null);
@@ -36626,13 +36691,14 @@ function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
36626
36691
  }
36627
36692
  let live = true;
36628
36693
  setMe("reading");
36629
- void client.list({ table_id: meField.relation_target, filter: { user_id: viewerUserId }, limit: 1 }).then((answered) => {
36630
- if (live) setMe({ id: answered.ok ? answered.data.rows[0]?.id ?? null : null });
36694
+ void askWithOneRetry(() => client.list({ table_id: meField.relation_target, filter: { user_id: viewerUserId }, limit: 1 })).then((answered) => {
36695
+ if (!live) return;
36696
+ setMe({ id: meReads.take(answered, meAgain) ? answered.data.rows[0]?.id ?? null : null });
36631
36697
  });
36632
36698
  return () => {
36633
36699
  live = false;
36634
36700
  };
36635
- }, [client, enabled, mine, meField?.relation_target, viewerUserId]);
36701
+ }, [client, enabled, mine, meField?.relation_target, viewerUserId, meAttempt]);
36636
36702
  const own = {
36637
36703
  ...Object.fromEntries(Object.entries(block.filter ?? {}).filter(([, v]) => v !== null && v !== void 0)),
36638
36704
  ...extra
@@ -41980,7 +42046,8 @@ function TablePage({
41980
42046
  ) : null
41981
42047
  ] })
41982
42048
  ] }),
41983
- embedded ? null : /* @__PURE__ */ jsx132(GridShortcutsHelp, {})
42049
+ embedded ? null : /* @__PURE__ */ jsx132(GridShortcutsHelp, {}),
42050
+ /* @__PURE__ */ jsx132(ReadRefusalDock, {})
41984
42051
  ] });
41985
42052
  }
41986
42053
  var PUBLIC_READ_ONLY = "Public \xB7 read only";
@@ -41988,6 +42055,8 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
41988
42055
  const readOnly = rights.known && rights.read && !rights.write;
41989
42056
  const marked = table?.published_to_web;
41990
42057
  const [isPublic, setIsPublic] = useState121(false);
42058
+ const reads = useReadRefusal("table_facts");
42059
+ const [attempt, again] = useReadAgain();
41991
42060
  useEffect106(() => {
41992
42061
  if (!readOnly || !table) {
41993
42062
  setIsPublic(false);
@@ -41998,15 +42067,16 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
41998
42067
  return;
41999
42068
  }
42000
42069
  let live = true;
42001
- void client.tableFacts(organizationId ? { organization_id: organizationId } : {}).then((answered) => {
42070
+ void askWithOneRetry(() => client.tableFacts(organizationId ? { organization_id: organizationId } : {})).then((answered) => {
42002
42071
  if (!live) return;
42003
- const fact = answered.ok ? (answered.data ?? []).find((f) => f.table_id === tableId) : void 0;
42072
+ if (!reads.take(answered, again)) return;
42073
+ const fact = (answered.data ?? []).find((f) => f.table_id === tableId);
42004
42074
  setIsPublic(Boolean(fact && (fact.published_to_web ?? fact.visibility === "public")));
42005
42075
  });
42006
42076
  return () => {
42007
42077
  live = false;
42008
42078
  };
42009
- }, [client, organizationId, tableId, readOnly, marked, table]);
42079
+ }, [client, organizationId, tableId, readOnly, marked, table, attempt]);
42010
42080
  return readOnly && isPublic;
42011
42081
  }
42012
42082