almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Nested Config Options override defaults (specifically, Timeline 'format' option) #4192

Open mchong-teal opened 5 years ago

mchong-teal commented 5 years ago

I have an app with 2 Timeline objects, each with different format options (one default).

Setting format options in one of the timeline objects (to a custom function), overwrites the default format. (Stepping through, it seems that TimeStep.FORMAT is overwritten in some setOptions call when a deepExtend option is used. Seems like deepExtend is copying the 'default' object by reference, and then overwriting it's properties when it gets called again. setOptions for subcomponents get called twice (once when created by parent object, once by Core.setOptions.

This is bad b/c I have no way of creating a new timeline with the default format except for copy/pasting the format object into my code.

I'll add a code example when I get the chance.

chopchop505 commented 5 years ago

Confirmed - I'm seeing the same issue!

mojoaxel commented 5 years ago

Is this also an issue with other chart types (e.g. network) or is this only a timeline issue?