razbensimon / react-vis-timeline

React component for the vis-timeline module
MIT License
64 stars 47 forks source link

timeline always crash #47

Open HodayaGruz opened 2 years ago

HodayaGruz commented 2 years ago

Overview

Add general description explaining this issue i see that in the initial loa of vistimeline you add:

Object.defineProperty(this, 'timeline', {
            value: new VisTimelineCtor(this.#ref.current, this.items, this.groups, this.props.options),
            writable: false
        });

and in vis-timeline the groups is replace by the options since the groups is object:

 if (!(Array.isArray(groups) || isDataViewLike(groups)) && groups instanceof Object) {
      const forthArgument = options;
      options = groups;
      groups = forthArgument;
    }

(https://github.com/visjs/vis-timeline/blob/master/lib/timeline/Timeline.js)

Package versions

"react-vis-timeline": "^2.0.3", "vis-data": "^7.1.4", "vis-timeline": "^7.4.2", "web-vitals": "^2.1.4", "xss": "^1.0.11"

Steps to reproduce

Add step by step guide to reproduce issue

  1. Step 1
  2. Step 2

Code Snippet

  <Timeline
                ref={ref}
                key={uuid()}
                initialGroups={groups || []}
                initialItems={items}
                options={{
                    rtl: true,
                    orientation: "top",
                    verticalScroll: true,
                    zoomKey: "ctrlKey",
                    maxHeight: 500,
                    start: moment().format(),
                    groupEditable: true,
                    end: moment().add(5, "day").format(),
                    zoomMax: 31536000,
                }}
            />

Related issues

Any issue which is related to this issue

Screenshots (if appropriate)