Skip to content
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

fix(dataLayer): only update those data options which were changed #1152

Closed

Conversation

vincentsels
Copy link

@vincentsels vincentsels commented Sep 14, 2017

Fixes #1099 and probably similar issues, where updating the data of a data layer causes all data options to be cleared, because they are not passed along, hence null is passed in as a value to setControlPosition etc, instead of the actual values.

Note that this will obviously prevent actually clearing these 'data options' by setting them to null, but fixing this would require further refactoring.

@lazarljubenovic
Copy link
Collaborator

lazarljubenovic commented Sep 17, 2017

With a single function like this, the only way (that I'm aware of) to differentiate between "leave this option as it was" and "clear this option" is to make use of difference between undefined and null.

So maybe it would be better to use if (xxx !== undefined) (notice the usage of strict comparison)?

But we should also check with how Google's JS API for Maps handles this and try to be as close as possible with it.

@sebholstein
Copy link
Owner

sebholstein commented Sep 17, 2017

I think the only way to make this more efficient would be to use the ngOnChanges callback and differenciate between the provided changes.

Otherwise, it would not be possible to change a certain setting to undefined or null.

So I'm closing this - feel free to open a new PR that covers a smarter update mechanism with the ngOnChanges callback. Thanks for your time 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data layer styling, geoJSON change no styles apply
3 participants