Skip to content

COPLAN-35: Keep Mermaid comments clickable#148

Open
aushvin23 wants to merge 1 commit into
block:mainfrom
aushvin23:aushvin/COPLAN-35/mermaid-comments
Open

COPLAN-35: Keep Mermaid comments clickable#148
aushvin23 wants to merge 1 commit into
block:mainfrom
aushvin23:aushvin/COPLAN-35/mermaid-comments

Conversation

@aushvin23

Copy link
Copy Markdown

Why

Plan authors and reviewers need to open, reply to, and resolve feedback anchored to architecture diagrams. Asynchronous Mermaid rendering currently removes those anchors after initial page load, leaving visible comment counts with no clickable thread in active reviews.

What changes

  • Re-highlight comment anchors after the current Mermaid render batch completes.
  • Keep direct-linked threads pending until a stable rendered Mermaid label exists.
  • Cover cold page loads, theme-triggered re-renders, and direct comment links with system tests.

Why this approach

This reuses the existing anchor matching and popover behavior on Mermaid's rendered HTML labels. A scoped Stimulus event coordinates diagram completion with comment highlighting without introducing a diagram-specific thread model or a second comment UI.

Risk / rollback

Risk is low and scoped to successfully rendered Mermaid content. Invalid diagrams continue to show their source and existing error state. Reverting this commit restores the previous behavior.

Test plan

  • rvm use ruby-3.4.7-portable do bundle exec rspec spec/system/comment_ux_spec.rb:180 spec/system/comment_ux_spec.rb:236
  • rvm use ruby-3.4.7-portable do bundle exec rspec (1,132 examples, 0 failures)
  • node --check engine/app/javascript/controllers/coplan/mermaid_controller.js
  • node --check engine/app/javascript/controllers/coplan/text_selection_controller.js

References

Linked ticket

  • COPLAN-35

Generated with Codex

@aushvin23
aushvin23 marked this pull request as ready for review July 17, 2026 01:07
@aushvin23
aushvin23 requested a review from HamptonMakes as a code owner July 17, 2026 01:07
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.

1 participant