-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
I'm using react-visjs-timeline as a react component in a page I have. I have a state setter function (created using UseState react hook).
In my onSelect handler I call the state setter function - but that triggers a redraw of the timeline and the selection in the timeline disappears.
How can I set some state based on the selected item in the timeline without losing the item from being selected? Here's my selection handler. The setSelectedCue is the function that sets the state and triggers the selection to be lost.
function onSelectHandler ({items, event}) {
if (items.length === 1)
{
const cueData = this.itemSet.items[items[0]].data;
const cueObj = cueData.itemType === "FIREWORK" ?
show.fireworkCues.filter(cue => cue._id === cueData.itemID) :
show.lightCues.filter(cue => cue._id === cueData.itemID);
setSelectedCue({cueType: cueData.itemType, cueObj: cueObj});
}
}
rilias, DavidMash and meneman
Metadata
Metadata
Assignees
Labels
No labels