Error: Uncaught (in promise) TypeError: Cannot read property ‘createElement’ of null
From: this.doc.createElement(t)
So I seem to be having a problem while using Turbolinks. I think there are known problems with Turbolinks, but removing the previous elements usually gets around it.
The fix I’m using involves using a parent component with the ID and options. Then on page load I grab all the elements, empty them, and then create a new div inside them to render the widget.
twttr.widgets.createTimeline(options.id, $div[0], options)
This works perfectly on the first page. Then if I go forward a page, and then back I get in error in the console once the promise (returned from createTimeline) produces the error seen above. The widget still loads correctly and looks fine, but I’m just wondering how to get past these errors in the console.
Thanks for your help!