-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Only call update if no other source prop other than data differs #5745
Conversation
b97313f
to
7aedd2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the source is clustered both before and after, but the cluster settings are different (e.g. clusterRadius
), this case will break as well, right? So should we compare all properties of a source (except data) for a full fix?
Good point, will adapt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, let's avoid the lodash
dependency (the one already there will be removed shortly too #5744).
Since all those properties are not nested and with simple values, a short vanilla JS function with a for in
loop will be enough.
8db30c0
to
ed858b8
Compare
thanks for the guidance @mourner I updated the PR |
src/style-spec/diff.js
Outdated
commands.push({ command: operations.setGeoJSONSourceData, args: [sourceId, after[sourceId].data] }); | ||
} else { | ||
updateSource(sourceId, after, commands, sourcesRemoved); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can move the canUpdateGeoJSON
condition to the parent if
, which will remove the need for the else
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes made
878634e
to
d3a11cb
Compare
Thanks @bartvde ! |
This PR fixes #5731