Skip to content

Commit

Permalink
fix: consider 0 as id
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertOrthofer committed Sep 25, 2023
1 parent f3b7815 commit 98c172a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions elements/map/src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ export async function addSelect(
if (options.idProperty) {
return feature.get(options.idProperty);
}
const defaultId = feature.getId() || feature.get("id");
if (!defaultId) {
if (feature.getId() !== undefined) {
return feature.getId();
}
if (feature.get("id") !== undefined) {
return feature.get("id");
}
throw Error(
"No feature id found. Please provide which feature property should be taken instead using idProperty."
);
}
return defaultId;
}

const selectLayer = EOxMap.getLayerById(layerId);
await selectLayer.get("sourcePromise");
Expand Down

0 comments on commit 98c172a

Please sign in to comment.