Skip to content

Fix ZIP-based radius search field visibility#2851

Closed
Arafat-plugins wants to merge 1 commit into
sovware:developmentfrom
Arafat-plugins:fix/zip-radius-visibility
Closed

Fix ZIP-based radius search field visibility#2851
Arafat-plugins wants to merge 1 commit into
sovware:developmentfrom
Arafat-plugins:fix/zip-radius-visibility

Conversation

@Arafat-plugins
Copy link
Copy Markdown
Contributor

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

This PR fixes an issue with ZIP-based radius search where the radius field could be hidden unexpectedly and the ZIP value was not always preserved on the search result page.

Directorist supports radius search based on ZIP code. When Radius Search is configured to work based on ZIP, the radius field should appear when a ZIP code is entered and should remain visible when the search result page loads with a ZIP value in the request.

Before this change:

  • The radius visibility logic used global selectors instead of the active search form context.
  • ZIP-based radius visibility could behave inconsistently when other search fields or forms existed on the page.
  • The ZIP field could render empty on the search result page even when zip existed in the request.
  • Because of that, the radius field could remain hidden after page load.

After this change:

  • Radius visibility is checked within the active search form context.
  • ZIP-based radius forms now react to ZIP input correctly.
  • Address input no longer controls radius visibility when the form is configured for ZIP-based radius search.
  • The ZIP field falls back to the request value when its rendered value is empty.
  • The radius field remains visible on the search result page when ZIP is already present.

How to reproduce / How to test

  1. In Directorist Search Form Builder, add ZIP and Radius Search fields.
  2. Configure Radius Search to work based on ZIP.
  3. Open the search page.
  4. Enter a ZIP code.

Before this change:

  • The radius field could remain hidden or behave inconsistently.

After this change:

  • The radius field becomes visible after entering a ZIP code.

Additional test:

  1. Visit a search result page with a ZIP query in the URL.
  2. Example:
    ?directory_type=basic&zip=80331&miles=0-98&view=list

Before this change:

  • The ZIP field could appear empty.
  • The radius field could be hidden on page load.

After this change:

  • The ZIP field remains populated.
  • The radius field remains visible.

Regression check:

  1. Keep the form configured for ZIP-based radius search.
  2. Enter only Address without entering ZIP.
  3. Confirm the radius field does not appear.
  4. This confirms ZIP-based radius visibility is not incorrectly controlled by Address input.

Any linked issues

Fixes: https://taiga-sovware-u10698.vm.elestio.app/project/directorist/issue/2917

Screenshot

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant