@proveanything/smartlinks-utils-ui 0.12.14 → 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 = [
|
|
@@ -9361,9 +9374,7 @@ function RecordsAdminShellInner(props) {
|
|
|
9361
9374
|
} else {
|
|
9362
9375
|
removeRecordFromCaches(queryClient, notice.ctx, notice.recordId);
|
|
9363
9376
|
}
|
|
9364
|
-
queryClient.
|
|
9365
|
-
queryKey: scopeCountsQueryKey(notice.ctx.collectionId, notice.ctx.appId, notice.ctx.recordType)
|
|
9366
|
-
});
|
|
9377
|
+
markScopeCountsStale(queryClient, notice.ctx);
|
|
9367
9378
|
};
|
|
9368
9379
|
return () => {
|
|
9369
9380
|
recordChangeRef.current = null;
|
|
@@ -10068,9 +10079,7 @@ function RecordsAdminShellInner(props) {
|
|
|
10068
10079
|
try {
|
|
10069
10080
|
const updated = await SL.app.records.update(collectionId, appId, record.id, { status: next }, true);
|
|
10070
10081
|
patchRecordStatusInCaches(queryClient, ctx, record.id, next);
|
|
10071
|
-
queryClient
|
|
10072
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
10073
|
-
});
|
|
10082
|
+
markScopeCountsStale(queryClient, ctx);
|
|
10074
10083
|
if (updated) {
|
|
10075
10084
|
patchRecordIntoCaches(queryClient, ctx, updated);
|
|
10076
10085
|
}
|
|
@@ -10189,9 +10198,7 @@ function RecordsAdminShellInner(props) {
|
|
|
10189
10198
|
i18n,
|
|
10190
10199
|
onChanged: (_next, updated) => {
|
|
10191
10200
|
patchRecordStatusInCaches(queryClient, ctx, selectedSummary.id, _next);
|
|
10192
|
-
queryClient
|
|
10193
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
10194
|
-
});
|
|
10201
|
+
markScopeCountsStale(queryClient, ctx);
|
|
10195
10202
|
if (updated) {
|
|
10196
10203
|
patchRecordIntoCaches(queryClient, ctx, updated);
|
|
10197
10204
|
}
|
|
@@ -10219,9 +10226,7 @@ function RecordsAdminShellInner(props) {
|
|
|
10219
10226
|
}),
|
|
10220
10227
|
onChanged: (_next, updated) => {
|
|
10221
10228
|
patchRecordStatusInCaches(queryClient, ctx, selectedSummary.id, _next);
|
|
10222
|
-
queryClient
|
|
10223
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
10224
|
-
});
|
|
10229
|
+
markScopeCountsStale(queryClient, ctx);
|
|
10225
10230
|
if (updated) {
|
|
10226
10231
|
patchRecordIntoCaches(queryClient, ctx, updated);
|
|
10227
10232
|
}
|
|
@@ -11294,9 +11299,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11294
11299
|
try {
|
|
11295
11300
|
const updated = await SL.app.records.update(collectionId, appId, id, { status: archivedStatusValue }, true);
|
|
11296
11301
|
patchRecordStatusInCaches(queryClient, ctx, id, archivedStatusValue);
|
|
11297
|
-
queryClient
|
|
11298
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
11299
|
-
});
|
|
11302
|
+
markScopeCountsStale(queryClient, ctx);
|
|
11300
11303
|
if (updated) patchRecordIntoCaches(queryClient, ctx, updated);
|
|
11301
11304
|
onTelemetry?.({
|
|
11302
11305
|
type: "recordAction.invoke",
|
|
@@ -11308,9 +11311,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11308
11311
|
console.warn("[RecordsAdminShell] archive-duplicate failed", id, err);
|
|
11309
11312
|
}
|
|
11310
11313
|
}
|
|
11311
|
-
queryClient
|
|
11312
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
11313
|
-
});
|
|
11314
|
+
markScopeCountsStale(queryClient, ctx);
|
|
11314
11315
|
} : void 0,
|
|
11315
11316
|
onDeleteDuplicates: enableDeleteDuplicates ? async () => {
|
|
11316
11317
|
const ids = singletonConflicts.flatMap((c) => c.duplicates.map((d) => d.id)).filter((id) => !!id);
|
|
@@ -11328,9 +11329,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11328
11329
|
console.warn("[RecordsAdminShell] delete-duplicate failed", id, err);
|
|
11329
11330
|
}
|
|
11330
11331
|
}
|
|
11331
|
-
queryClient
|
|
11332
|
-
queryKey: scopeCountsQueryKey(ctx.collectionId, ctx.appId, ctx.recordType)
|
|
11333
|
-
});
|
|
11332
|
+
markScopeCountsStale(queryClient, ctx);
|
|
11334
11333
|
} : void 0,
|
|
11335
11334
|
i18n: {
|
|
11336
11335
|
title: i18n.conflictBannerTitle,
|