@ai-matrx/records 0.84.4 → 0.84.5

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.
@@ -368,6 +368,16 @@ function announceRecordChanged(recordId) {
368
368
  }
369
369
  }
370
370
  }
371
+ var removed = /* @__PURE__ */ new Set();
372
+ function markRecordRemoved(recordId) {
373
+ removed.add(recordId);
374
+ }
375
+ function markRecordRestored(recordId) {
376
+ removed.delete(recordId);
377
+ }
378
+ function isRecordRemoved(recordId) {
379
+ return removed.has(recordId);
380
+ }
371
381
  function onRecordChanged(listener) {
372
382
  listeners.add(listener);
373
383
  return () => listeners.delete(listener);
@@ -4898,7 +4908,10 @@ function createRecordsClient(given) {
4898
4908
  { p_organization_id: org, p_record_id: record_id },
4899
4909
  "recordDelete"
4900
4910
  );
4901
- if (result.ok) announceRecordChanged(record_id);
4911
+ if (result.ok) {
4912
+ markRecordRemoved(record_id);
4913
+ announceRecordChanged(record_id);
4914
+ }
4902
4915
  return result;
4903
4916
  },
4904
4917
  async recordRestore({ record_id }) {
@@ -4907,7 +4920,10 @@ function createRecordsClient(given) {
4907
4920
  { p_organization_id: org, p_record_id: record_id },
4908
4921
  "recordRestore"
4909
4922
  );
4910
- if (result.ok) announceRecordChanged(record_id);
4923
+ if (result.ok) {
4924
+ markRecordRestored(record_id);
4925
+ announceRecordChanged(record_id);
4926
+ }
4911
4927
  return result;
4912
4928
  },
4913
4929
  async tableArchive({ table_id, chunk, includeTable }) {
@@ -8670,7 +8686,7 @@ function liveRecordFor(recordId, tableId) {
8670
8686
  const stops = [];
8671
8687
  stops.push(
8672
8688
  onRecordChanged((changed) => {
8673
- if (changed === recordId) entry.refetch();
8689
+ if (changed === recordId && !isRecordRemoved(recordId)) entry.refetch();
8674
8690
  })
8675
8691
  );
8676
8692
  const client = entry.client;
@@ -8681,7 +8697,7 @@ function liveRecordFor(recordId, tableId) {
8681
8697
  { organization_id: client.config.organizationId, table_id: tableId },
8682
8698
  {
8683
8699
  records(ids) {
8684
- if (ids === null || ids.includes(recordId)) entry.refetch();
8700
+ if ((ids === null || ids.includes(recordId)) && !isRecordRemoved(recordId)) entry.refetch();
8685
8701
  },
8686
8702
  shape() {
8687
8703
  tableShapeChanged(tableId);