Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disappearing Orders search field when using Orders Autosuggest #3682

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented Oct 5, 2023

Description of the Change

Prevents a crash occurring in Instant Results and Orders Autosuggest for requests to the search API that return a non-200 or non-JSON response by catching and logging errors to the console.

Closes #3675

How to test the Change

  1. Enable Orders Autosuggest and sync.
  2. Filter ep_woocommerce_order_search_endpoint to return any string that is not a valid seach endpoint.
  3. Go to WooCommerce > Orders and enter a search query without submitting.
  4. The search form should not disappear.
  5. Check the browser console. An error starting with "ElasticPress: Unable to fetch results." should be shown with the original error message. In this example it is likely "HTTP 404".

Changelog Entry

Fixed - Fixed an issue where there WooCommerce Orders search field would disappear when Orders Autosuggest is receiving an unexpected response from ElasticPress.io.

Credits

Props @JakePT @anjulahettige

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@JakePT JakePT requested a review from felipeelia October 5, 2023 03:19
@JakePT JakePT self-assigned this Oct 5, 2023
@JakePT JakePT changed the title Catch errors fetching results. Fix disappearing Orders search field when using Orders Autosuggest Oct 5, 2023
@felipeelia felipeelia added this to the 4.7.2 milestone Oct 5, 2023
@felipeelia felipeelia merged commit db3aa9a into develop Oct 5, 2023
9 of 10 checks passed
@felipeelia felipeelia deleted the fix/3675 branch October 5, 2023 11:17
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.

BUG: Orders search form disappears when Orders Autosuggest crashes
2 participants