mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
72.16k stars 6.56k forks source link

Stuck while drawing Gantt chart with a large time span #3274

Open purocean opened 2 years ago

purocean commented 2 years ago

To Reproduce Steps to reproduce the behavior: Rendering a Gantt chart with a large time span.

Expected behavior Limit the maximum time span to avoid getting stuck.

Screenshots

Code Sample

https://mermaid.live/edit#pako:eNptzUEKgzAQheGrhFlH0EChZGdpT9DtbAYz2oCZlDgWinj3Coqr7h4_H7wFuhwYPAwkqigTdxqzmBalNb4rUS1t5cPWmMBTY42rnavqa1U39pwXlNsf7XZ94IACFhKXRDFsjwuKMQj64sQIfpuBe5pHRUBZNzq_Ayk_QtRcwPc0TmyBZs3Pr3Rn2NU90lAoHXX9AbkhRCI

gantt
section A
A :crit,active,  des1, 2022-08-01,2022-08-05
B :crit,active,  des2, 202208-01,2d

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

https://github.com/mermaid-js/mermaid/blob/c20c36255724f51f1d94b28611c51f86b1929f0f/src/diagrams/gantt/ganttRenderer.js#L436

tommoor commented 1 year ago

This feels like a potential security issue of sorts, completely locks up the browser tab

fuzyll commented 1 year ago

Just ran into this over the weekend and would like to give it a bump. It's a massive usability issue when what you're trying to do surrounds a year boundary. Any time you have a "2023" you need to change to a "2024", if you backspace the "3", you run the risk of the entire tab crashing.

nirname commented 1 year ago

There was a test that was created while we were trying to address this issue. Unfortunately, changes didn't work as expected, so that the issue is still relevant, the test fails:

gantt
title A long Gantt Diagram
dateFormat   YYYY-MM-DD
axisFormat   %m-%d
tickInterval 1day
excludes     weekends

section Section
A task           : a1, 9999-10-01, 30d
Another task     : after a1, 20d
section Another
Task in sec      : 2022-10-20, 12d
another task     : 24d

Because the problem is still present we will comment out this test, and later one any contributor can give it a shot and try fixing it.