namespace-ee / react-calendar-timeline

A modern and responsive react timeline component.
MIT License
1.94k stars 637 forks source link

Visible Time Start/End calling onTimeChange on mount when page is intially loaded #790

Open Zanoro9000 opened 3 years ago

Zanoro9000 commented 3 years ago

Describe the bug I've spent a decent amount of time tracking this down and it may not be a bug, I just may need more clarification. What I understand to be happening is I am manually setting visibleTimeStart/End on my timeline.

if (componentScrollLeft !== scrollLeft) { this.scrollComponent.scrollLeft = scrollLeft this.scrollHeaderRef.scrollLeft = scrollLeft }

To Reproduce

I cannot get the example with provided visibleTimeStart/End working for me, but if there's a response and needs further clarification I can try to cobble together something.

Expected behavior I expect the scroll event to not trigger or to somehow have the widths figured out so that it doesn't call onTimeChange on the initial render.

Screenshots This is the expected range - this can be gotten from navigating to the page from another page image

This is the range after it jitters from the initial (ex. when loading the page from refresh) image

Library Version 0.27.0

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

Love the package so far! Thanks for making this available.

stahlmanDesign commented 3 years ago

I don't know if my issue is related or not, but I also have "jitter" or "snapping" that I believe is caused by scroll events calling onTimeChange internally or unpredictably with a controlled timeline (visibleTimeStart/End). I also had trouble building a simplified example to reproduce.