Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sanitize style attributes in data attribute in DrawControl.js for ups…
…tream serialization. - Fix for jupyter-widgets#1119 - The main issue is that a `style()` function is added to the GeoJSON object in `create_obj()`, which triggers an error at serialization time: https://github.com/jupyter-widgets/ipywidgets/blob/e1718c2b3bf0b143580ef87f71c55fbc6ed50a77/packages/base/src/widget.ts#L587 - This is because `structuredClone` throws an error for functions: https://web.dev/structured-clone/#features-and-limitations. While the article mentions drawbacks for using `JSON.parse(JSON.stringify(...))`, I believe that this component does not produce any non-primitive properties, so will remove any offending lines. - Tested by placing a breakpoint and testing directly on the browser.
- Loading branch information