-
Notifications
You must be signed in to change notification settings - Fork 85
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
Replace native structuredClone
with custom cloneDeep
function
#256
Conversation
@hupe13 let me know. |
structuredClone
with a custom cloneDeep
functionstructuredClone
with custom cloneDeep
function
The error is gone, but I don't see both on my test page and on your example the marker . |
Check this out now and also check out the other examples with this change because it's quite likely that something else could be broken.. |
I went through my test pages and didn't find any errors because of this, but I found some errors in my application. |
leaflet-elevation/libs/leaflet-distance-marker.js Lines 135 to 141 in 8681792
Vanilla JS and Leaflet JS are not to able clone (or merge) complex data structures (eg. nested objects and instances of classes), that's why we needed to add a deep clone algorithm for the default options (eg: to fix #238 (comment)). // GOAL: merge "foo.bar.a" and "foo.bar.b" attributes --> { foo: { bar: { a: 'some value', b: 'another value'} } }
const foo_bar_a = { foo: { bar: { a: 'some value'} } };
const foo_bar_b = { foo: { bar: { b: 'another value'} } };
const leaflet_result = L.extend({}, foo_bar_a, foo_bar_b);
const native_result = Object.assign({}, foo_bar_a, foo_bar_b);
console.log(leaflet_result.foo.bar); // LOGS: { b: 'another value'}
console.log(native_result.foo.bar); // LOGS: { b: 'another value'} So, taking a quick look, these are some options that I think might break: leaflet-elevation/src/options.js Lines 24 to 29 in b0006d6
leaflet-elevation/src/options.js Lines 56 to 63 in b0006d6
leaflet-elevation/src/options.js Line 73 in b0006d6
leaflet-elevation/examples/leaflet-elevation_extended-ui.html Lines 255 to 271 in b0006d6
I don't think I understand what you mean.. |
I found some errors in my code. (My english is not good, I'm using translators.) |
Fixes a regression introduced by: #240
Closes: #255