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

Type coercion has been deprecated. Please, use data pipes instead. #254

Closed
rvillalba-novetta opened this issue Jan 15, 2020 · 9 comments
Closed
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@rvillalba-novetta
Copy link

rvillalba-novetta commented Jan 15, 2020

I'm getting the following log printing to my console whenever I update the timeline's DataSet with dataSet.update()

backend.js:6 Type coercion has been deprecated. Please, use data pipes instead. See https://visjs.github.io/vis-data/data/datapipe.html#TypeCoercion for more details with working migration example.

r | @ | backend.js:6
  | warnTypeCorectionDeprecation | @ | esm.js:14
  | _getItem | @ | esm.js:14
  | get | @ | esm.js:14
  | (anonymous) | @ | ItemSet.js:1146
  | _onUpdate | @ | ItemSet.js:1145
  | update | @ | ItemSet.js:165
  | (anonymous) | @ | esm.js:14
  | _trigger | @ | esm.js:14
  | update | @ | esm.js:14

I'm on the latest version of vis-timeline.

@alebx
Copy link

alebx commented Jan 17, 2020

I also get this warning and I am unable to comprehend what I am doing wrong.
I am simply setting the data via the setData method.

@anderschbe
Copy link

anderschbe commented Jan 17, 2020

+1, this is a rather nasty problem, as it added 4-5 ms PER item to our updates. Given that there seems to be no easy way yet to access the DataPipe constructor (at least it's not exported by vis-data, nor easily accessible therefrom), this is blocking.

@yotamberk yotamberk added the bug Something isn't working label Jan 18, 2020
@yotamberk yotamberk self-assigned this Jan 18, 2020
@yotamberk
Copy link
Member

@Thomaash Can you please explain how things work with data pipes?

@yotamberk yotamberk added question Further information is requested and removed bug Something isn't working labels Jan 18, 2020
@Thomaash
Copy link
Member

Thomaash commented Jan 18, 2020

Hi @rvillalba-novetta, @alebx, @anderschbe and anybody else reading this,

I anticipated this issue and there is a section at the end of the docs (https://visjs.github.io/vis-data/data/datapipe.html) to help you with transition. It includes a piece of code that you can copy paste to get very similar functionality. It's not a drop in replacement though because you'll end up with uncoerced (input) and coerced (output) data sets.

Regarding the constructor that is indeed not exported. It is created using a builder that you can obtain by calling createNewDataPipeFrom function.

PS: If you still have some questions after reading the docs feel free to mention me.
PPS: In case someone wonders why: This is done to get rid of Moment.js from the data set. Due to the split into separate packages we ended up bundling 3 copies of Moment.js into Timeline atop of that each quite likely a different version. Removing this feature and Moment.js with it was the most sensible solution.

Thomaash added a commit that referenced this issue Jan 18, 2020
Switch from the deprecated type property of Data Set to Data Pipes. This
solves some or maybe all issues from #254.

PS: There is a bug in Vis Data that prevents this from working see
visjs/vis-data/pull/78.
@Thomaash
Copy link
Member

Okay so I think I have everything figured out. I didn't realize how heavily dependent Vis Timeline is on this functionality. Once it's reviewed (hopefully there are no more issues in the PRs) everything should work fine.

My previous comment applies only if you use type coersion directly (the type map from the Data Set). If you don't it will be resolved by an update soon.

@Thomaash Thomaash added the bug Something isn't working label Jan 18, 2020
@Thomaash
Copy link
Member

It is a bug after all.

Thomaash added a commit that referenced this issue Jan 19, 2020
Switch from the deprecated type property of Data Set to Data Pipes. This
solves some or maybe all issues from #254.

PS: There is a bug in Vis Data that prevents this from working see
visjs/vis-data/pull/78.
Thomaash added a commit that referenced this issue Jan 22, 2020
Switch from the deprecated type property of Data Set to Data Pipes. This
solves some or maybe all issues from #254.

PS: There is a bug in Vis Data that prevents this from working see
visjs/vis-data/pull/78.
@AsafEini
Copy link

Hey, any progress with this bug? it explodes the console with tons for warning and traces.
generally updating the dataSet became very slow.
would be happy to know in which version the coercion issue still hasn't been merged so i can use that version in the meantime..

@Thomaash
Copy link
Member

6.4.0 introduced this. A fix that would solve this (#259) awaits review.

It's also possible to just update Vis Data as the logging has been reduced a lot in last release.

yotamberk pushed a commit that referenced this issue Jan 25, 2020
* fix(type-coercion): use Data Pipes

Switch from the deprecated type property of Data Set to Data Pipes. This
solves some or maybe all issues from #254.

PS: There is a bug in Vis Data that prevents this from working see
visjs/vis-data/pull/78.

* docs(type-coercion): add more documentation

* fix(type-coersion): prevent potential NPE
@yotamberk
Copy link
Member

Fixed with #259

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

No branches or pull requests

6 participants