Skip to content

fix(map): prevent style leak to new objects#251

Open
vuntz wants to merge 2 commits into
devfrom
MON-197924-map-default-style-leak
Open

fix(map): prevent style leak to new objects#251
vuntz wants to merge 2 commits into
devfrom
MON-197924-map-default-style-leak

Conversation

@vuntz

@vuntz vuntz commented Jun 11, 2026

Copy link
Copy Markdown
Member

Description

Fixes: MON-197924

In the MAP editor, customizing a property on a cell (border color, text
color, etc.) was leaking into the defaults applied to subsequently
created cells. The styleChanged event handler in EditorUi.js
mutates graph.currentVertexStyle / graph.currentEdgeStyle, but the
event is fired by every style-editing call site (color pickers,
format panel, action toggles), not just the explicit "Set as Default
Style" action.

Gate the current-style update on a new settingDefaultStyle flag that
is only true around the styleChanged event fired from
setDefaultStyle(). Other style edits no longer pollute the defaults;
only the explicit "Set as Default Style" action (Ctrl+Shift+D) updates
them.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • 23.10.x
  • 24.04.x
  • 24.10.x
  • 25.10.x
  • master

How this pull request can be tested ?

  1. Open the MAP editor.
  2. Add a basic shape and apply a custom border color (e.g. red).
  3. Add a new basic shape — it must use the default border color, not the red from step 2.
  4. Repeat with text color and across object types (resource shape, link, text element). None should inherit the previous color.
  5. Apply a custom color, save the map, reload — the color must remain scoped to the cell it was applied to.
  6. Non-regression: select a cell, run "Set as Default Style" (Ctrl+Shift+D). Subsequently created cells must still inherit that style.

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified.
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (master, maintenance).

The styleChanged event is fired by many style-editing call sites
(color pickers, format panel, action toggles). Each of those was
mutating graph.currentVertexStyle / graph.currentEdgeStyle, so a
color or other property applied to one cell leaked into the
defaults used for subsequently inserted cells.

Gate the current-style update on a new settingDefaultStyle flag
that is only true around the styleChanged event fired from
setDefaultStyle(). Other style edits no longer pollute the
defaults; only the explicit "Set as Default Style" action does.

Refs: MON-197924
@vuntz vuntz requested a review from a team as a code owner June 11, 2026 12:22
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.

3 participants