311-data icon indicating copy to clipboard operation
311-data copied to clipboard

DEV - Bugfix: Clearing the address does not clear the Address pin, NC selection

Open rayneng opened this issue 1 year ago • 4 comments

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

  1. putting in an address, which zooms to that location
  2. clear the address
  3. observe that it will NOT do the following
    • reset zoom level
    • clear NC boundary chip
    • clear the house icon

rayneng avatar Feb 16 '25 19:02 rayneng

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

rayneng avatar Mar 01 '25 18:03 rayneng

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.

ykimdeveloper avatar Jun 14 '25 21:06 ykimdeveloper

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 avatar Jun 19 '25 00:06 ykimdeveloper

@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

rayneng avatar Aug 14 '25 01:08 rayneng