mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 06:11:07 -05:00
917 B
917 B
Search Form Fix
Issue
Search results were being duplicated because selecting a suggestion triggered both:
- The suggestions form submission (to /suggest_parks/)
- 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
- Modified the
@search-selectedhandler to:- Set the search query in filter form
- Submit filter form to update results
- Hide suggestions dropdown
- Added proper form IDs and refs
Benefits
- Eliminates duplicate requests
- Maintains correct search behavior
- Improves user experience