SandDance
SandDance copied to clipboard
Sanddance Mutates Frozen Objects
Issue
If an object is frozen ( by default React Apollo does this ), the chart fails to render and it doesn't tell you the error unless you break on uncaught exceptions.
Exception: TypeError: Cannot add property GL_ORDINAL, object is not extensible at
http://localhost:3000/static/js/bundle.js:159322:61 at Array.forEach (<anonymous>) at assignOrdinals
(http://localhost:3000/static/js/bundle.js:159321:10) at Viewer.<anonymous>
(http://localhost:3000/static/js/bundle.js:160146:83) at Generator.next (<anonymous>) at
http://localhost:3000/static/js/bundle.js:159693:67 at new Promise (<anonymous>) at __awaiter
(http://localhost:3000/static/js/bundle.js:159672:10) at Viewer._render (http://localhost:3000/static/js/bundle.js:160133:12)
at Viewer.<anonymous> (http://localhost:3000/static/js/bundle.js:160090:29)
Can you iterate over your data and add a wrapper over each item? {...item}
Yes - thats how I resolved it.
Ideally Sanddance would probably either make its own copy or use a lookup table for this metadata ( < personally I would lean towards that approach ).
We avoid making a copy to minimize memory usage for large datasets.
Related: https://github.com/vega/vega/issues/2453