Description
QueryRenderedFeatures.svelte crashes if feature.id is undefined
Use case
Using the component with an MVT server that does not provide ids for a feature will throw an error in the {#each} block
Uncaught Svelte error: each_key_duplicate
Keyed each block has duplicate key `undefined` at indexes 0 and 1
https://svelte.dev/e/each_key_duplicate
in <unknown>
in QueryRenderedFeatures.svelte
// line 58
{#if children}{#each features as feature (feature.id)}{@render children(feature)}{/each}{/if}
Feature may have an undefined id, so the component should handle the case.
// MapLibre
export declare class GeoJSONFeature {
//
id: number | string | undefined;
//
}
I have a fix and will push a PR shortly