SandDance icon indicating copy to clipboard operation
SandDance copied to clipboard

Sanddance Mutates Frozen Objects

Open amcdnl opened this issue 3 years ago • 3 comments

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)

amcdnl avatar Apr 01 '22 13:04 amcdnl

Can you iterate over your data and add a wrapper over each item? {...item}

danmarshall avatar Apr 01 '22 16:04 danmarshall

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 ).

amcdnl avatar Apr 01 '22 18:04 amcdnl

We avoid making a copy to minimize memory usage for large datasets.

danmarshall avatar Apr 01 '22 23:04 danmarshall

Related: https://github.com/vega/vega/issues/2453

danmarshall avatar Jan 05 '23 00:01 danmarshall