@conduction/nextcloud-vue 2.56.0-beta.41 → 2.56.0-beta.42

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.
@@ -43,6 +43,7 @@ import { resolveForge, DEFAULT_FORGE } from '../../utils/forge.js';
43
43
  import { BUILT_IN_KB_PROVIDERS } from '../../utils/kbSearchProviders.js';
44
44
  import { createManifestTranslate } from '../../utils/manifestTranslate.js';
45
45
  import { installModalStack, uninstallModalStack } from '../../utils/modalStack.js';
46
+ import { OBJECTS_CHANGED_EVENT } from '../../utils/objectSignals.js';
46
47
  import { resolveBrand } from '../../utils/resolveBrand.js';
47
48
  import { resolveFilterTokens } from '../../utils/resolveFilterTokens.js';
48
49
  import { passesContextPredicates } from '../../utils/visibleIfContext.js';
@@ -2525,6 +2526,7 @@ var script = {
2525
2526
  // write lands; this warns the user while there are unsaved/in-flight
2526
2527
  // changes. Registered before the early-return so it always installs.
2527
2528
  window.addEventListener('beforeunload', this.onBeforeUnload);
2529
+ window.addEventListener(OBJECTS_CHANGED_EVENT, this.onObjectsChanged);
2528
2530
 
2529
2531
  // Opt-out fast-path: empty `requiresApps` already initialised
2530
2532
  // `capabilitiesLoading` to `false` in data(); skip the check.
@@ -2570,6 +2572,7 @@ var script = {
2570
2572
  this.removeDiagnostics = null;
2571
2573
  }
2572
2574
  window.removeEventListener('beforeunload', this.onBeforeUnload);
2575
+ window.removeEventListener(OBJECTS_CHANGED_EVENT, this.onObjectsChanged);
2573
2576
  this.cnScopedTheme.teardown(this.appId);
2574
2577
  // Scope the side effect to the shell's lifetime. Layers already written
2575
2578
  // stay on screen (see `uninstallModalStack`), so a dialog outliving the
@@ -3416,13 +3419,17 @@ var script = {
3416
3419
  * response `total` written to `cnMenuItemCounts[item.id]`. The
3417
3420
  * request goes straight through axios rather than the object store,
3418
3421
  * so the index page's whole-schema total in the store is left alone.
3419
- * Failures leave the badge unrendered.
3422
+ * Failures leave the badge unrendered. Given a changed register and
3423
+ * schema, only the entries counting that list are read again.
3420
3424
  *
3421
3425
  * @spec openspec/changes/zuiddrecht-pixel-gaps/specs/zuiddrecht-pixel-gaps/spec.md#requirement-a-menu-entry-counts-a-filtered-list
3426
+ * @param {{register?: string|null, schema?: string|null}|null} [changed] The list that changed; null reads every count.
3422
3427
  * @return {void}
3423
3428
  * @private
3424
3429
  */
3425
- _hydrateMenuItemCounts() {
3430
+ _hydrateMenuItemCounts(changed = null) {
3431
+ const register = changed?.register ?? null;
3432
+ const schema = changed?.schema ?? null;
3426
3433
  const collect = (items) => {
3427
3434
  const out = [];
3428
3435
  for (const item of items ?? []) {
@@ -3437,10 +3444,27 @@ var script = {
3437
3444
  return out
3438
3445
  };
3439
3446
  for (const item of collect(this.manifest?.menu)) {
3440
- this._fetchMenuItemCount(item);
3447
+ if ((register === null || item.count.register === register) && (schema === null || item.count.schema === schema)) {
3448
+ this._fetchMenuItemCount(item);
3449
+ }
3441
3450
  }
3442
3451
  },
3443
3452
 
3453
+ /**
3454
+ * Objects changed outside the list showing them (`cn:objects-changed`,
3455
+ * see `dispatchObjectsChanged`): read the filtered menu counts of that
3456
+ * register and schema again, so a badge follows a claim, a close or a
3457
+ * bulk action instead of keeping the number it had at mount. A signal
3458
+ * without a register or schema reads every filtered count again.
3459
+ *
3460
+ * @spec openspec/changes/menu-counts-follow-changed-objects/specs/layout-components/spec.md#requirement-a-filtered-menu-count-follows-changed-objects
3461
+ * @param {CustomEvent} event The signal, with `detail: { register, schema, id }`.
3462
+ * @return {void}
3463
+ */
3464
+ onObjectsChanged(event) {
3465
+ this._hydrateMenuItemCounts(event?.detail ?? null);
3466
+ },
3467
+
3444
3468
  /**
3445
3469
  * One filtered-count request for a menu entry; see
3446
3470
  * `_hydrateMenuItemCounts`.