Skip to content

Replace current Marker key with true unique ID #2

@connorbillen

Description

@connorbillen

Currently, we just rely on the index of the data piece in the GeoJSON file for the unique key that is associated with each marker. As we add features like filtering, the total number of elements being rendered will change, which will cause the key values to change for all markers, which will cause React to destroy and re-create the scope for that marker and re-render (which is unnecessarily expensive). We should add a UID to each row in the GeoJSON. As this code is being run on the client machine, we don't want to add a unique ID to each row "in post" in the client code.

https://github.com/code-for-charlottesville/cville-streetlights-web-app/blob/main/src/components/MainMap.js#L45

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions