Skip to content
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

Replace current Marker key with true unique ID #2

Open
connorbillen opened this issue Apr 8, 2021 · 1 comment
Open

Replace current Marker key with true unique ID #2

connorbillen opened this issue Apr 8, 2021 · 1 comment

Comments

@connorbillen
Copy link
Collaborator

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

@connorbillen connorbillen changed the title Replace current Markey key with true unique ID Replace current Marker key with true unique ID Apr 8, 2021
@rakshita-kaulgud
Copy link
Collaborator

Yes, good point. I'll add that to the list of action items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants