Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline doubleclick bug: cannot read property 'itemSet' #274

Closed
llmartinll opened this issue Jan 31, 2020 · 2 comments
Closed

Timeline doubleclick bug: cannot read property 'itemSet' #274

llmartinll opened this issue Jan 31, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@llmartinll
Copy link

llmartinll commented Jan 31, 2020

Issue introduced with vis-timeline since v6.4.3, specifically commit 2861085 dealing with issue #202

Issue description

On double clicking an item, no onDoubleclick event is triggered/exposed, and the console shows the following error: ERROR TypeError: Cannot read property 'itemSet' of undefined

Important detail: we have updateTime option set to true, whilst updateGroup is set to False

Analysis:

My best guess, is that above commit is not the root cause but highlights a different problem.

In the repaintDragCenter() method, onUpdateItem is called to update the item, before a doubleClick is emitted. The onUpdateItem function however, returns a rangeItem without parent value, which then breaks the code below the call, that would emit the doubleclick event.
It breaks because it tries to access me.parent, whilst the cloned item doesn't contain a parent value.

image

image

The reason that this used to work for us before the commit mentioned above, is that we have updateTime option set to true, whilst updateGroup is set to False. In the older situation, this would cause _onUpdateItem to immediately break out of the method. This way, it didn't get a clone of the data from the dataset without parent value, and me still refered to the object with a parent value set. So in the old scenario, the repaintDragCenter would still work as 'expected' without in fact actually updating the item.

image

Solutions

I'm not familiar enough with vis to determine the best way to address this otherwise I'd have created a PR instead. Assuming this in a bug in vis-timeline and not an fault of our ouple of ideas:

  • Remove me.parent.itemSet._onUpdateItem(me); line from _repaintDragCenter method
  • Let theme.itemsData.get(item.id); inside _onUpdateItem return an cloned object with parent value set
  • revert the above commit
  • ?
@yotamberk yotamberk added the bug Something isn't working label Jan 31, 2020
@yotamberk
Copy link
Member

Can you please create a simple example I can reproduce the bug so I can fix the issue?

@llmartinll
Copy link
Author

llmartinll commented Feb 6, 2020

@yotamberk I'm sorry for the delay.
I tried to make an example but couldn't reproduce it initially.

In short, it turns out that we have listeners on changes in the state of the timeline, which re-sets (instead of updates) the visData with the setData method. This is triggered by the _onUpdateItem call in Vis. Which is why the parent value is unset in the midst of the repaintDragCenter method. We'll address this in our application.

If you find it worthwhile, I could find some time to make a reproducible example next week, but it doesn't seem like a bug in Vis after all. I'll close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants