Open udalrich opened 6 years ago
Any updates here? This is really a pain for me - I've tried to workaround it where possible....
@larrywal @udalrich how did you fix this in your codebase eventually
I feel like I made a local copy and edited VisTimeline to recalculate the handler. But I'm not able to find that at the moment, so I can't see exactly what I did. If my memory is correct, it wasn't a complicated change.
Thanks @udalrich. Found a way around it by re-rendering the component every time the item changes. Works for my use case. Appreciated
Overview
Handlers are only initialized in componentDidMount, so it does handler changes based on state changes do not result in an updated hander.
Package versions
react-visas-timeline: 1.4.0 vis version: 4.21.0
Steps to reproduce
Create a timeline with a clickHandler that depends on the state. Change that part of the state. Click the item.
The original handler is called.
Code Snippet
Add additional elements to so that items changes from its initial value. After items is updated, clicking on an item prints the original value of items.
Related issues
Screenshots (if appropriate)