ankane/chartkick.js

Server rendering breaks due to implicit window check

Closed this issue · 2 comments

A project I'm working on currently has server-side rendering. Chartkick breaks when compiling for the server due to no window object being present. It's possible to address the test for this:

let config = window.Chartkick || {};
becomes something like
let config = (typeof window !== 'undefined' && window.Chartkick) || {};

I'd be happy to raise a PR if you feel this would be an acceptable change.

A PR sounds good to me. I haven't tried server-side rendering, so may be other things that need updated as well.

Hey @mikehdt, about to push a new release, so made the change you suggested. Thanks!