-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A suggestion to drop lodash.clonedeep in favour of structuredClone #503
Comments
Yes indeed, I prefer structuredClone as well, if you can create a PR I would be happy to review and merge |
@sedghi I created a PR #517. Although the builds and tests passed locally, the tests here failed. From the logs I see there is one of the errors:
I double checked the MDN docs for structuredClone() and by looking at supported types it seems that HTML and SVG elements are not present. A quick test in the a JS console confirmed that: I'm leaving the draft PR open in case if anyone wants to investigate different solutions to these cases. |
Yes, thanks |
When I import
@cornerstonejs/core
into an Angular project and try to build it I get the following warning:This is a common warning that appears if pretty much any lodash feature is used (or other commonjs dependencies) and there is a good reason behind. But even if we put Angular aside, it's always a good thing if we can get rid of 3rd party packages when there is an opportunity. Since Cornerstone 3D is meant to be for modern browsers anyway, we could use the structuredClone() method for deep cloning of objects instead of relying on
lodash.clonedeep()
. The function is supported by pretty much every modern desktop and mobile browser with the exception that it's not available in workers on Opera and Safari.The text was updated successfully, but these errors were encountered: