Skip to content

refactor(graph): move the label, z-order and page members to their mixins - #1135

Open
redfish4ktc wants to merge 1 commit into
refactor/move_cells_validation_overlays_members_to_mixinsfrom
refactor/move_label_order_page_members_to_mixins
Open

refactor(graph): move the label, z-order and page members to their mixins#1135
redfish4ktc wants to merge 1 commit into
refactor/move_cells_validation_overlays_members_to_mixinsfrom
refactor/move_label_order_page_members_to_mixins

Conversation

@redfish4ktc

Copy link
Copy Markdown
Member

Note

Stacked on top of #1134, itself stacked on #1132 and #1131. The base of this PR is refactor/move_cells_validation_overlays_members_to_mixins, so the diff shown here contains only this step.

Fourth implementation step of the plan recorded in ADR 0003 (#1130). No behavior change, and the public API is unchanged.

Changes

Target Members Only internal consumers
LabelMixin convertValueToString, getLinkForCell getLabel, plus EditingMixin and TooltipHandler
OrderMixin keepEdgesInForeground, keepEdgesInBackground GraphView
PageMixin pageVisible, pageBreaksVisible, pageBreakColor, pageBreakDashed, minPageBreakDist, preferPageSize, pageScale, their accessors, and getPreferredPageSize updatePageBreaks, sizeDidChange

AbstractGraph.ts loses 142 lines and its last use of isNode. LabelMixin stops declaring convertValueToString as an external dependency, and the page mixin stops declaring six accessors it now owns.

OrderMixin was the smallest mixin in the codebase, holding only orderCells and cellsOrdered. Z-order is exactly its concern, so the two flags belong there.

PageBreaksMixin becomes PageMixin

Decision D5 of the ADR. Once the mixin holds the page settings and not only the break rendering, its old name no longer describes its scope.

The rename is internal: mixins are not exported outside view/mixin/, and index.ts only imports the aggregated _graph-mixins-types.js for its side effect. No public symbol changes, and the diff is the two mixin files plus the two registration files.

The same deliberate asymmetry as #1134

getPageFormat moves but pageFormat stays in AbstractGraph, in the per-instance group. Its default is a mutable Rectangle, so installing it on the prototype would share one instance across every graph, which the tests from #1131 guard against.

A comment in PageMixin records why the pair is split. It will be reunited when the mixin becomes a plugin, step 6 of the ADR plan.

Validation

Run locally on Node 24 (.nvmrc): build, test-check, the full suite (505 tests, 60 suites), lint, check:circular-dependencies. All passing, and no test needed changing, which is the expected signal for a pure relocation.

@redfish4ktc redfish4ktc added the refactor Code refactoring label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98f16ffc-4e60-400e-95a3-62e014053571

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…xins

Continue emptying AbstractGraph of members whose only consumers live in an existing mixin.

To LabelMixin, whose getLabel is the main caller of the first: convertValueToString and getLinkForCell. LabelMixin
stops declaring convertValueToString as an external dependency.

To OrderMixin, which was until now the smallest mixin with only orderCells and cellsOrdered: keepEdgesInForeground and
keepEdgesInBackground. Their single consumer is GraphView, and z-order is exactly the concern this mixin covers.

To the page mixin, which already picked six of the getters from the class: pageVisible, pageBreaksVisible,
pageBreakColor, pageBreakDashed, minPageBreakDist, preferPageSize and pageScale with their accessors, plus
getPreferredPageSize.

Rename PageBreaksMixin to PageMixin as part of that last move. Once the mixin holds the page settings and not only the
break rendering, its name no longer describes its scope. The rename is internal, mixins are not exported outside their
directory and index.ts only imports the aggregated types for their side effect, so no public symbol changes.

pageFormat stays in AbstractGraph for the same reason as warningImage: its default is a mutable Rectangle that mixInto
would install on the prototype and share across every graph instance. Only getPageFormat moves, and a comment in the
mixin records why the pair is split.

AbstractGraph loses 142 lines and its last use of isNode.
@tbouffard
tbouffard force-pushed the refactor/move_label_order_page_members_to_mixins branch from d88631b to 4138c94 Compare August 12, 2026 04:50
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant