@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.
@@ -80,6 +80,16 @@ function announceRecordChanged(recordId) {
80
80
  }
81
81
  }
82
82
  }
83
+ var removed = /* @__PURE__ */ new Set();
84
+ function markRecordRemoved(recordId) {
85
+ removed.add(recordId);
86
+ }
87
+ function markRecordRestored(recordId) {
88
+ removed.delete(recordId);
89
+ }
90
+ function isRecordRemoved(recordId) {
91
+ return removed.has(recordId);
92
+ }
83
93
  function onRecordChanged(listener) {
84
94
  listeners.add(listener);
85
95
  return () => listeners.delete(listener);
@@ -4610,7 +4620,10 @@ function createRecordsClient(given) {
4610
4620
  { p_organization_id: org, p_record_id: record_id },
4611
4621
  "recordDelete"
4612
4622
  );
4613
- if (result.ok) announceRecordChanged(record_id);
4623
+ if (result.ok) {
4624
+ markRecordRemoved(record_id);
4625
+ announceRecordChanged(record_id);
4626
+ }
4614
4627
  return result;
4615
4628
  },
4616
4629
  async recordRestore({ record_id }) {
@@ -4619,7 +4632,10 @@ function createRecordsClient(given) {
4619
4632
  { p_organization_id: org, p_record_id: record_id },
4620
4633
  "recordRestore"
4621
4634
  );
4622
- if (result.ok) announceRecordChanged(record_id);
4635
+ if (result.ok) {
4636
+ markRecordRestored(record_id);
4637
+ announceRecordChanged(record_id);
4638
+ }
4623
4639
  return result;
4624
4640
  },
4625
4641
  async tableArchive({ table_id, chunk, includeTable }) {
@@ -8382,7 +8398,7 @@ function liveRecordFor(recordId, tableId) {
8382
8398
  const stops = [];
8383
8399
  stops.push(
8384
8400
  onRecordChanged((changed) => {
8385
- if (changed === recordId) entry.refetch();
8401
+ if (changed === recordId && !isRecordRemoved(recordId)) entry.refetch();
8386
8402
  })
8387
8403
  );
8388
8404
  const client = entry.client;
@@ -8393,7 +8409,7 @@ function liveRecordFor(recordId, tableId) {
8393
8409
  { organization_id: client.config.organizationId, table_id: tableId },
8394
8410
  {
8395
8411
  records(ids) {
8396
- if (ids === null || ids.includes(recordId)) entry.refetch();
8412
+ if ((ids === null || ids.includes(recordId)) && !isRecordRemoved(recordId)) entry.refetch();
8397
8413
  },
8398
8414
  shape() {
8399
8415
  tableShapeChanged(tableId);