Skip to content

cards: re-sync bundled cards.js to the canonical shared controller - #413

Closed
TheWitness wants to merge 1 commit into
developfrom
cards/harmonize-shared-bundle
Closed

TheWitness wants to merge 1 commit into
developfrom
cards/harmonize-shared-bundle

Conversation

@TheWitness

Copy link
Copy Markdown
Member

Harmonizes the already-merged Card API conversion (#412) against the current canonical shared controller.

What

\js/cards.js\ is re-synced to the canonical \CactiCards\ controller (md5 \76df6bdb…) that Cacti core (1.2.x) and the other Card API plugins ship. #412 merged with an earlier copy that carried a local duplicate-add guard, leaving mactrack's bundle byte-divergent.

mactrack uses only the card chrome (no chart primitives), so no \card-widgets.css\ is bundled; \css/cards.css\ is already byte-identical to canonical.

Convergence note

The controller is converging from several directions:

  • a dup-add guard (here + intropage #473),
  • refresh/resize generation-token + async-remove-commit + toggle-focus hardening on develop #8683 (\c24a98c2).

This PR restores the current 1.2.x canonical (\76df6bdb). When the converged controller is finalized, every bundle - core, plugins, and this one - re-syncs to it together. Draft until then.

plugin_mactrack #412 merged with an earlier cards.js, leaving it byte-divergent
from the canonical CactiCards controller. Re-sync it to the converged baseline
(md5 84876af1) that Cacti core (#8684 for 1.2.x, #8683 for develop) and every
Card API plugin now carry: the refresh/resize supersede guard, async
remove-commit, the duplicate-add guard and expand/collapse keyboard focus.

mactrack uses only the card chrome (no chart primitives), so no card-widgets.css
is bundled; css/cards.css is already byte-identical to canonical.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TheWitness
TheWitness force-pushed the cards/harmonize-shared-bundle branch from b0085c4 to 30eaf88 Compare November 10, 2026 12:39
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness marked this pull request as ready for review November 12, 2026 01:00
Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The added controller hardening conflicts with the stated canonical-restoration scope, so the implementation or the documented baseline and target checksum must be aligned.

1 open issue
What changed in this PR

Updates MacTrack’s bundled CactiCards controller as part of aligning dashboard card behavior across Cacti and its plugins.

Changes:

  • Adds shared request tokens to discard stale refresh and resize responses.
  • Defers card removal and layout persistence until the adapter’s removal promise resolves.
  • Moves keyboard focus to the counterpart control after expanding or collapsing a card.
File Description
js/​cards.js Hardens asynchronous card updates, removal handling, and toggle focus.

Review effort: Balanced

Comment thread js/cards.js
Comment on lines +176 to +179
/* A per-card-id request generation shared by refresh and resize so a slow
* response cannot overwrite the markup of a newer request for the same card
* (for example a refresh that lands after a later grow). The most recently
* started request for an id wins; earlier in-flight responses are discarded. */
@TheWitness

Copy link
Copy Markdown
Member Author

Superseded by #416 (merge commit 98ed786), which is already merged into develop. MacTrack's bundled card assets on develop are now binary-identical to Cacti 1.2.x: js/cards.js (md5 b9d7d2c0) and css/cards.css (md5 c4337c8d) both match include/js/cards.js / include/css/cards.css in Cacti 1.2.x. MacTrack bundles only the chart-free card chrome, so it correctly ships no card-widgets.css.

This branch's cards.js (84876af1) is an older lineage that is actually behind develop — it lacks the willExpand/capturedExpanded swap-time state-preservation hardening that #416 brought in. Resolving it against the authoritative 1.2.x controller yields an empty diff, so there is nothing left for this PR to contribute. Closing as superseded.

@TheWitness TheWitness closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants