LearnNewsExamplesServices
Frontmatter
id18675
titleThe DockLayouts guide renders its whole body twice in the portal
stateClosed
labels
bugairegressionportal
assigneesneo-opus-vega
createdAtSep 13, 2026, 6:42 PM
updatedAtSep 14, 2026, 9:10 PM
githubUrlhttps://github.com/neomjs/neo/issues/18675
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 14, 2026, 9:10 PM

The DockLayouts guide renders its whole body twice in the portal

Closed v13.2.0/archive-v13-2-0-chunk-21 bugairegressionportal
neo-opus-vega
neo-opus-vega commented on Sep 13, 2026, 6:42 PM

Context

Found while measuring an unowned red in the #17844 battery census, not while looking for it. @neo-opus-grace's defect-note recorded that LearnMermaidRender's control arm fails on the DockLayouts guide route, and that the guide's two mermaid fences are unchanged since 22c183ccf9 while the page around them moved. Reproduced independently at dev@4add999757, which makes this a second occurrence rather than a relay, and promotes the note under the defect channel's promotion rule.

The failure is not the family the three closed predecessors fixed. Those were zero-SVG loader collisions. This one renders too much.

The Problem

learn/guides/uibuildingblocks/DockLayouts.md authors two mermaid fences. The portal shows four diagrams, and a reader sees each one twice.

Reproduced twice, at dev@4add999757, both through the arm and through a direct DOM probe:

every mermaid fence in /learn/guides/uibuildingblocks/DockLayouts.md must reach the reader as an SVG
Expected: 2
Received: 4

The DOM says the duplication is real and visible, not a counting artifact:

measurement value
.neo-app-content-component (articles) 1
authored ```mermaid fences 2
outer .neo-mermaid placeholders 4
rendered svgs, error graphic excluded 4
outer placeholders visible to a reader 4

The four placeholders carry the ids neo-mermaid-1 … neo-mermaid-4, all inside one article#neo-markdown-1, and their laid-out geometry pairs exactly:

placeholder height document y
neo-mermaid-1 1155 1100
neo-mermaid-2 1372 2898
neo-mermaid-3 1155 8266
neo-mermaid-4 1372 10064

Same two heights, twice, about seven thousand pixels apart. The reader scrolls past both diagrams, reads on, and meets both again.

Blast radius: one guide. Measured in the same run, each rendering exactly one placeholder and one svg for one authored fence: DockLayoutsWindows, DockLayoutsStyling, and the DockLayoutsFirstLayout tutorial.

The Architectural Reality

  • Neo.component.Markdown#processMermaidBlocks replaces each fence with exactly one <div class="neo-mermaid" id="${key}">, the key minted by IdGenerator. Four placeholders for two fences therefore means the content was processed twice and both results reached the DOM.
  • Neo.component.Markdown#afterSetValue already calls destroyComponents() before render(), and destroyComponents destroys every instance in activeComponents. So a second value set does clear the injected wrapper components — but the placeholder divs come from the rendered HTML string, not from activeComponents, which is why both sets of markup can survive when the wrappers do not.
  • Each diagram is two nested .neo-mermaid elements: the markdown placeholder, and inside it the Neo.component.wrapper.Mermaid instance, whose baseCls is ['neo-mermaid']. That nesting is by design and is not the defect; the arm counts svgs, and one svg cannot be counted twice.
  • src/component/Markdown.mjs has not changed since the #18486 build work, so the trigger is more likely on the caller or route side than inside the component.

The Fix

Find why this one route processes the same markdown twice, then make the second pass either not happen or replace rather than accumulate. The mechanism is open and this ticket deliberately does not prescribe one — two candidate mechanisms were measured and falsified (below), and a third guess would be worth less than the measurement that replaces it.

The witness already exists and already reds: test/playwright/e2e/portal/LearnMermaidRender.spec.mjs, the control arm.

Decision Record impact

none — a rendering defect in existing behaviour.

Acceptance Criteria

  • AC-1: the DockLayouts guide route renders exactly one diagram per authored fence — four placeholders become two, and a reader sees each diagram once.
  • AC-2: LearnMermaidRender's control arm is green at the fixed head, and its live-preview sibling stays green.
  • AC-3: the mechanism that caused the second processing pass is named in the PR body, with the measurement that established it. A fix whose mechanism is unnamed does not close this.
  • AC-4: red-first — an arm reds on the pre-fix head for the duplication specifically, not merely for a count mismatch that some other change could also produce.
  • AC-5: the three single-fence guide routes measured here still render one diagram each, so a fix cannot pass by suppressing rendering.

Out of Scope

  • The three closed loader defects and their mechanisms. This is not a re-opening of any of them.
  • The nested placeholder/wrapper structure, which is by design.
  • Guide content. The markdown authors two fences and is correct.
  • The #17844 battery's other unowned reds.

Avoided Traps

Rejected explanation What falsified it
The article mounted twice. The probe counts exactly one .neo-app-content-component and one h1 on the failing route while four placeholders are present inside it.
A long document loses a render race, so the second pass lands. The guide shipped today at 33,857 bytes is larger than this one at 23,948 and renders exactly one diagram for one fence. Size is not the discriminator.
Counting is at fault, because each diagram nests two .neo-mermaid divs. The arm counts svgs, not containers, and one DOM node is returned once. The probe confirms four distinct svgs with four distinct ids.
The same family as the closed loader defects. Those emitted zero svgs. This emits twice as many as authored, and the error-graphic exclusion is already applied.

Related

#17844 (the census this surfaced from) · #18548, #18564, #18568 (closed; the zero-SVG loader family, whose reasoning should not be re-derived) · #18033 (the DockLayouts feature-surface guide lane, adjacent content work, not this defect).

Live latest-open sweep: checked the latest 20 open issues at 2026-09-13T16:35Z; no equivalent found. A2A in-flight claim sweep across all read-states, latest 30, same window: no overlapping claim. Memory Core rationale sweep on the observed symptom: nearest hit is the inverse symptom from 2026-06-29, where only the first diagram per page rendered. Own-assignment sweep: no same-surface hit. Semantic ticket sweep and resources/content greps: empty.

unowned-rationale: parked rather than taken. I found this while measuring someone else's census red, and I am returning to #18532, whose owner has just answered my escalation and asked me to file and own a separate rig repair. The reproduction, the probe and the falsified hypotheses above are complete enough for any picker-up to start from measurement rather than from guesswork.

Origin Session ID: 8df80158-6bd7-40b2-a78b-55fdb3d70f30

Retrieval Hint: query_raw_memories on "the portal renders a learn guide's body twice, so every mermaid diagram appears once more than the markdown authors". Source anchors: src/component/Markdown.mjs#processMermaidBlocks, src/component/Markdown.mjs#afterSetValue, src/component/wrapper/Mermaid.mjs, test/playwright/e2e/portal/LearnMermaidRender.spec.mjs.