You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mermaid has a direct dependency on window.load event to start rendering. This is triggered when a page initially loads, or when the page is refreshed. In applications based on many javascript frameworks, entering a page using a router usually does not invoke the window.load event. As a result mermaid does not render the text definitions.
A workaround is to initialize mermaid using the (deprecated) mermaid.init() method and point it to a specific container. There are few disadvantages of this approach:
mermaid.init() is deprecated and kept around only for backwards compatibility. Their documentation clearly recommends not to use it.
If the goal is to render all containers in a page decorated with the class name mermaid, this approach does not work. It works only when the page contains a single container where the text definitions needs to be rendered.
manastalukdar
changed the title
Mermaid does not initialize on page load from SPA route changes
Mermaid does not render on page load from SPA route changes
Sep 4, 2019
Overview
Mermaid has a direct dependency on
window.load
event to start rendering. This is triggered when a page initially loads, or when the page is refreshed. In applications based on many javascript frameworks, entering a page using a router usually does not invoke thewindow.load
event. As a result mermaid does not render the text definitions.A workaround is to initialize mermaid using the (deprecated)
mermaid.init()
method and point it to a specific container. There are few disadvantages of this approach:mermaid.init()
is deprecated and kept around only for backwards compatibility. Their documentation clearly recommends not to use it.mermaid
, this approach does not work. It works only when the page contains a single container where the text definitions needs to be rendered.There is a related issue in the mermaid repo.
This issue is to explore a solution to this behavior.
Potential Solutions
The text was updated successfully, but these errors were encountered: