DEV - Bugfix: Clearing the address does not clear the Address pin, NC selection
Overview
We need to fix a bug where the user attempts to reset their Address selection but the Address pin and selected NC remains, resulting in users being confused about how to reset their selections.
Action Items
- [ ] WIP
Resources/Instructions
- Comment that describes the problem: https://github.com/hackforla/311-data/pull/1910#issuecomment-2649121822
Steps to Reproduce
- putting in an address, which zooms to that location
- clear the address
- observe that it will NOT do the following
- reset zoom level
- clear NC boundary chip
- clear the house icon
Adding notes to this ticket:
- I thought that this bug shouldn't occur because clicking "X" should call Map.reset: https://github.com/hackforla/311-data/pull/1910#issuecomment-2641357165
ETA: I expect to have a fix ready within the next 2 days. If I encounter any blockers, I’ll update here.
Testing: I’ll include steps to test the fix before requesting a review. Let me know if there’s any additional context I should consider.
Update
Current Behavior:
After implementing:
const handleDelete = e => {
console.log('Clearing address and resetting map...');
resetAddressSearch(); // Clears address input and related state
resetMap(); // Resets map zoom and markers
setSearchTerm(''); // Clears district council search field
};
…the map and selections do not consistently reset when navigating to a different section. It only clears after removing the address manually.
Findings
To fully reset the user state, we likely need to invoke all three actions at once:
dispatchUpdateNcId(null); // Clears selected council in Redux
resetMap(); // Resets map zoom and markers
resetAddressSearch(); // Clears address input and related state
However, applying this unconditionally may create a frustrating user experience if it resets every time the user pans/zooms or navigates around the map.
Next Steps
- I’m exploring a conditional reset to ensure that clearing selections feels intuitive and doesn’t wipe state unnecessarily.
- This may involve detecting whether the address was manually cleared vs. view-only interaction.
ETA
I’m still working through this edge case, but I expect to have a fix ready within the next 3 days. If anything unexpected pops up, I’ll post an update here.
@ykimdeveloper I'm seeing this is in draft. Are you working on filling out this ticket? If not, we can move it back to ready for dev lead and unassign you