Files
thrillwiki_django_no_react/memory-bank/decisions/search-form-fix.md

917 B

Search Form Fix

Issue

Search results were being duplicated because selecting a suggestion triggered both:

  1. The suggestions form submission (to /suggest_parks/)
  2. The filter form submission (to /park_list/)

Root Cause

The @search-selected event handler was submitting the wrong form. It was submitting the suggestions form which has hx-target="#search-results" instead of the filter form which has hx-target="#park-results".

Solution

Update the event handler to submit the filter form instead of the search form. This ensures only one request is made to update the results.

Implementation

  1. Modified the @search-selected handler to:
    • Set the search query in filter form
    • Submit filter form to update results
    • Hide suggestions dropdown
  2. Added proper form IDs and refs

Benefits

  • Eliminates duplicate requests
  • Maintains correct search behavior
  • Improves user experience