react-event-timeline icon indicating copy to clipboard operation
react-event-timeline copied to clipboard

Crash when Timeline gets null as a child.

Open UjinT34 opened this issue 6 years ago • 3 comments

React.cloneElement(...): The argument must be a React element, but you passed null. The above error occurred in the component: in Timeline (created by TimelineComponent)

https://github.com/rcdexta/react-event-timeline/blob/master/components/Timeline.js#L8 https://stackoverflow.com/questions/55327901/react-treats-timeline-element-as-null-even-with-a-condition-check/55328070#55328070

UjinT34 avatar Mar 24 '19 20:03 UjinT34

Something similar happens to me when logging out on my app:

TypeError: Cannot read property 'props' of null
    at Object.ReactElement.js.m.cloneElement (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at eval (/node_modules/react-event-timeline/dist/Timeline.js:1)
    at u (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at o (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at o (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at i (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at c (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at Object.l [as map] (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)
    at t.e (/node_modules/react-event-timeline/dist/Timeline.js:1)
    at h._renderValidatedComponentWithoutOwnerOrContext (44c44d30d32601e20aa98f13c405a7f1b9076b49.js?meteor_js_resource=true:17)

Is there a workaround?

vladejs avatar Apr 05 '19 20:04 vladejs

I also experienced this bug. Is there any solution to this?

howdyhyber avatar Oct 02 '19 08:10 howdyhyber

I sort of solved it.

When the value is null, pass an empty div and everything will be fine.

howdyhyber avatar Oct 02 '19 08:10 howdyhyber