pyatyispyatil / flame-chart-js

Extensible component for incredibly fast viewing of flame charts
https://pyatyispyatil.github.io/flame-chart-js/
MIT License
98 stars 20 forks source link

Infinit loop while resize from a height of 0 #68

Open gmorer opened 3 months ago

gmorer commented 3 months ago

I'm am using flame chart as a toggle chart in react, by changing the parent height. Which end up with an height of 0. In truncateChildrenLayout() , I end up with an array of placements of static type or with an height of 0, which end up in an infinit loop.

pyatyispyatil commented 3 months ago

Thanks for the report! I will try to fix this bug in the near future.

Agron-Kabashi commented 3 weeks ago

This is the cause from what I can tell: https://github.com/pyatyispyatil/flame-chart-js/blob/ec9d1e24ddc4531fe5783c70aad1c80824594f6f/src/engines/render-engine.ts#L208-L210

lastFlexibleIndex could become -1 and that leads to the infinite loop since the value of diff remains constant. What's the expected behaviour here, break the loop?