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

updateOnly method doesn't work properly when using Date object #1014

Open
alexdeia opened this issue Mar 1, 2023 · 0 comments
Open

updateOnly method doesn't work properly when using Date object #1014

alexdeia opened this issue Mar 1, 2023 · 0 comments

Comments

@alexdeia
Copy link

alexdeia commented Mar 1, 2023

See details visjs/vis-timeline#1562

update method works properly, but updateOnly loses Date object and reset it to empty object {}

p.s. Don't pay attention to vue-visjs name of package, I use wrapper for vue. It is ok, I checked it on just vis-data

vue-visjs.esm.js:15300 Uncaught TypeError: Cannot convert object of type Object to type Date
    at convert (vue-visjs.esm.js:15300:181)
    at vue-visjs.esm.js:15334:238
    at Array.reduce (<anonymous>)
    at vue-visjs.esm.js:15334:210
    at Array.map (<anonymous>)
    at vue-visjs.esm.js:11424:44
    at vue-visjs.esm.js:11341:14
    at Array.reduce (<anonymous>)
    at SimpleDataPipe._transformItems (vue-visjs.esm.js:11340:31)
    at SimpleDataPipe._update (vue-visjs.esm.js:11366:30)
@alexdeia alexdeia changed the title updateOnly method doesn't work correctly updateOnly method doesn't work correctly when using Date object Mar 1, 2023
@alexdeia alexdeia changed the title updateOnly method doesn't work correctly when using Date object updateOnly method doesn't work properly when using Date object Mar 1, 2023
Thomaash pushed a commit to visjs/vis-util that referenced this issue Oct 3, 2023
vis-util (used by vis-data, used in turn by vis-timeline) has some cloning/merging logic that works fine with primitives, Arrays, and Objects, but not so well with anything else. Ideally, it'd be nice if there was a generalizable fix for this that worked with arbitrary classes, but dates are common, at least in the vis-timeline case, and with the tests provided, are now guaranteed to work.

There's also an unrelated cross-env change that I needed to make the BABEL_ENV thing in package.json work on Windows, but I suppose we can drop that if it's unwanted.

This should cover visjs/vis-data#1014 and visjs/vis-timeline#1562 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant