Skip to content

Commit

Permalink
fix: trigger featureChanged on feature props change (#1201)
Browse files Browse the repository at this point in the history
Call `featureChanged` every time a feature is added with modified properties.

Co-authored-by: Peter Morton <[email protected]>
  • Loading branch information
petermoz and peter-greenatlas authored Dec 11, 2023
1 parent 4a99f0b commit e3cb6bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ export default function(ctx, api) {
} else {
// If a feature of that id has already been created, and we are swapping it out ...
const internalFeature = ctx.store.get(feature.id);
const originalProperties = internalFeature.properties;
internalFeature.properties = feature.properties;
if (!isEqual(internalFeature.properties, feature.properties)) {
if (!isEqual(originalProperties, feature.properties)) {
ctx.store.featureChanged(internalFeature.id);
}
if (!isEqual(internalFeature.getCoordinates(), feature.geometry.coordinates)) {
Expand Down

0 comments on commit e3cb6bc

Please sign in to comment.