This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
Remove state flag from useUpdateLeafletMapImperatively to avoid loop #1393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When navigating from the facility search results list to the facility details view the final
useEffect
block inuseUpdateLeafletMapImperatively
was triggering a render loop. Removing the state flag used within thatuseEffect
block eliminated the rendering loop without breaking any desired map pan and zoom functionality.Connects #1297
Connects #1392
Demo
Notes
I checked that the behaviors described in #799 are not affected.
facility
ID, set the map view on the facility location, zoomed to level 15
facility is outside of the bbox OR the zoom level is
within the range in which the facilities grid layer is shown, pan to the
facility and set the zoom level at 15. This ensures that the facility
details marker will be visible even if the map was at grid-layer zoom
levels before
While testing that this also fixes #1392 we saw that there was an error logged to the console and shown in the WDS overlay error viewer when navigating from the map page to a page without the map. It looks like this may be the result of some react-leaflet code trying to operate on the map related DOM elements that are no longer on the page.
This error does not appear to affect functionality
Testing Instructions
Checklist
fixup!
commits have been squashed