@proveanything/smartlinks-utils-ui 0.12.13 → 0.12.15

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.
@@ -179,6 +179,19 @@ function patchRecordStatusInCaches(queryClient, ctx, recordId, status) {
179
179
  });
180
180
  }
181
181
  }
182
+ function markScopeCountsStale(queryClient, ctx) {
183
+ const all = queryClient.getQueriesData({
184
+ queryKey: SCOPE_COUNTS_QK
185
+ });
186
+ for (const [key, cache] of all) {
187
+ if (!cache || !Array.isArray(cache.records)) continue;
188
+ if (!matchesScopeCountsCtx(key, ctx)) continue;
189
+ queryClient.invalidateQueries({
190
+ queryKey: key,
191
+ refetchType: "none"
192
+ });
193
+ }
194
+ }
182
195
  function removeRecordFromCaches(queryClient, ctx, recordId) {
183
196
  if (!recordId) return;
184
197
  const all = [
@@ -7600,11 +7613,12 @@ function SiblingRail({
7600
7613
  const key = def.value;
7601
7614
  const existing = map.get(key);
7602
7615
  if (existing) existing.items.push(item);
7603
- else map.set(key, { label: def.label, items: [item] });
7616
+ else map.set(key, { label: def.label, tone: def.tone ?? "default", items: [item] });
7604
7617
  }
7605
7618
  return Array.from(map.entries()).map(([key, v]) => ({
7606
7619
  key,
7607
7620
  label: v.label,
7621
+ tone: v.tone,
7608
7622
  items: v.items,
7609
7623
  isActive: activeValues.includes(key)
7610
7624
  })).sort((a, b) => compareLifecycleBuckets(a.key, b.key)).filter((b) => b.items.length > 0);
@@ -7729,30 +7743,15 @@ function SiblingRail({
7729
7743
  {
7730
7744
  type: "button",
7731
7745
  className: "ra-sibling-bucket-header",
7746
+ "data-tone": bucket.tone,
7732
7747
  onClick: () => !bucket.isActive && toggleBucket(bucket.key),
7733
7748
  "aria-expanded": open,
7734
7749
  disabled: bucket.isActive,
7735
- style: {
7736
- display: "flex",
7737
- alignItems: "center",
7738
- gap: "6px",
7739
- width: "100%",
7740
- padding: "6px 10px",
7741
- background: "transparent",
7742
- border: 0,
7743
- borderTop: "1px solid hsl(var(--ra-border))",
7744
- font: "inherit",
7745
- fontSize: "11px",
7746
- fontWeight: 600,
7747
- textTransform: "uppercase",
7748
- letterSpacing: "0.04em",
7749
- color: "hsl(var(--ra-muted-text))",
7750
- cursor: bucket.isActive ? "default" : "pointer"
7751
- },
7750
+ style: { cursor: bucket.isActive ? "default" : "pointer" },
7752
7751
  children: [
7753
7752
  !bucket.isActive ? open ? /* @__PURE__ */ jsx(ChevronDown, { className: "w-3 h-3", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "w-3 h-3", "aria-hidden": "true" }) : null,
7754
- /* @__PURE__ */ jsx("span", { children: bucket.label }),
7755
- /* @__PURE__ */ jsx("span", { style: { marginLeft: "auto", fontWeight: 500 }, children: bucket.items.length })
7753
+ /* @__PURE__ */ jsx("span", { className: "ra-sibling-bucket-label", children: bucket.label }),
7754
+ /* @__PURE__ */ jsx("span", { className: "ra-sibling-bucket-count", children: bucket.items.length })
7756
7755
  ]
7757
7756
  }
7758
7757
  ),
@@ -9375,9 +9374,7 @@ function RecordsAdminShellInner(props) {
9375
9374
  } else {
9376
9375
  removeRecordFromCaches(queryClient, notice.ctx, notice.recordId);
9377
9376
  }
9378
- queryClient.invalidateQueries({
9379
- queryKey: scopeCountsQueryKey(notice.ctx.collectionId, notice.ctx.appId, notice.ctx.recordType)
9380
- });
9377
+ markScopeCountsStale(queryClient, notice.ctx);
9381
9378
  };
9382
9379
  return () => {
9383
9380
  recordChangeRef.current = null;
@@ -10082,11 +10079,9 @@ function RecordsAdminShellInner(props) {
10082
10079
  try {
10083
10080
  const updated = await SL.app.records.update(collectionId, appId, record.id, { status: next }, true);
10084
10081
  patchRecordStatusInCaches(queryClient, ctx, record.id, next);
10082
+ markScopeCountsStale(queryClient, ctx);
10085
10083
  if (updated) {
10086
10084
  patchRecordIntoCaches(queryClient, ctx, updated);
10087
- queryClient.invalidateQueries({
10088
- queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
10089
- });
10090
10085
  }
10091
10086
  } catch (err) {
10092
10087
  console.warn("[RecordsAdminShell] lifecycle update failed", err);
@@ -10203,11 +10198,9 @@ function RecordsAdminShellInner(props) {
10203
10198
  i18n,
10204
10199
  onChanged: (_next, updated) => {
10205
10200
  patchRecordStatusInCaches(queryClient, ctx, selectedSummary.id, _next);
10201
+ markScopeCountsStale(queryClient, ctx);
10206
10202
  if (updated) {
10207
10203
  patchRecordIntoCaches(queryClient, ctx, updated);
10208
- queryClient.invalidateQueries({
10209
- queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
10210
- });
10211
10204
  }
10212
10205
  }
10213
10206
  }
@@ -10233,11 +10226,9 @@ function RecordsAdminShellInner(props) {
10233
10226
  }),
10234
10227
  onChanged: (_next, updated) => {
10235
10228
  patchRecordStatusInCaches(queryClient, ctx, selectedSummary.id, _next);
10229
+ markScopeCountsStale(queryClient, ctx);
10236
10230
  if (updated) {
10237
10231
  patchRecordIntoCaches(queryClient, ctx, updated);
10238
- queryClient.invalidateQueries({
10239
- queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
10240
- });
10241
10232
  }
10242
10233
  }
10243
10234
  }
@@ -11308,6 +11299,7 @@ function RecordsAdminShellInner(props) {
11308
11299
  try {
11309
11300
  const updated = await SL.app.records.update(collectionId, appId, id, { status: archivedStatusValue }, true);
11310
11301
  patchRecordStatusInCaches(queryClient, ctx, id, archivedStatusValue);
11302
+ markScopeCountsStale(queryClient, ctx);
11311
11303
  if (updated) patchRecordIntoCaches(queryClient, ctx, updated);
11312
11304
  onTelemetry?.({
11313
11305
  type: "recordAction.invoke",
@@ -11319,9 +11311,7 @@ function RecordsAdminShellInner(props) {
11319
11311
  console.warn("[RecordsAdminShell] archive-duplicate failed", id, err);
11320
11312
  }
11321
11313
  }
11322
- queryClient.invalidateQueries({
11323
- queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
11324
- });
11314
+ markScopeCountsStale(queryClient, ctx);
11325
11315
  } : void 0,
11326
11316
  onDeleteDuplicates: enableDeleteDuplicates ? async () => {
11327
11317
  const ids = singletonConflicts.flatMap((c) => c.duplicates.map((d) => d.id)).filter((id) => !!id);
@@ -11339,9 +11329,7 @@ function RecordsAdminShellInner(props) {
11339
11329
  console.warn("[RecordsAdminShell] delete-duplicate failed", id, err);
11340
11330
  }
11341
11331
  }
11342
- queryClient.invalidateQueries({
11343
- queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
11344
- });
11332
+ markScopeCountsStale(queryClient, ctx);
11345
11333
  } : void 0,
11346
11334
  i18n: {
11347
11335
  title: i18n.conflictBannerTitle,