Skip to content

fix: ensure exported images reflect recent style and configuration changes#1916

Open
ppmpreetham wants to merge 1 commit intomermaid-js:developfrom
ppmpreetham:patch-1
Open

fix: ensure exported images reflect recent style and configuration changes#1916
ppmpreetham wants to merge 1 commit intomermaid-js:developfrom
ppmpreetham:patch-1

Conversation

@ppmpreetham
Copy link
Copy Markdown

📑 Summary

This PR fixes a bug where exporting an image after changing the diagram's configuration (styles) would result in an image with the old styles. It ensures that changes made in the Config editor correctly trigger a diagram update so the exported image reflects the latest state.

📏 Design Decisions

Previously, when the diagram text was changed, updateCode properly triggered the updateDiagram: true flag. However, when the configuration was changed, the updateConfig function in src/lib/util/state.ts only updated the config string without setting the updateDiagram flag. Because of this, the exportImage function was relying on a stale render state, causing it to export the previous version of the diagram.

To fix this, I updated the updateConfig function to include updateDiagram: true, mirroring the behavior of updateCode. This explicitly signals the application to refresh the render cycle when styles are modified.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added unit/e2e tests (if appropriate)
  • 🔖 targeted develop branch

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for mermaidjs ready!

Name Link
🔨 Latest commit 45f0c46
🔍 Latest deploy log https://app.netlify.com/projects/mermaidjs/deploys/69c615302386c200080bff84
😎 Deploy Preview https://deploy-preview-1916--mermaidjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ppmpreetham ppmpreetham changed the title fix: trigger diagram update on config changes fix: ensure exported images reflect recent style and configuration changes Mar 27, 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.

1 participant