ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

Fix: JS error on Custom Results edit page

Open burhandodhy opened this issue 3 years ago • 0 comments

Description of the Change

This PR fixes the issue where the custom result edit page throws a JS error due to unavailability of post. It happens because the get_pointer_data_for_localize function is used to send the array of all posts even if it doesn't exist. I created a new array that would only return the data of existing WordPress posts based on the results of WP Query.

Closes #2881

How to test the Change

  • Create new Custom Results
  • Add some posts
  • Change the position of all posts.
  • Delete any post from the WordPress
  • Refresh the page and it would not throw any error

Changelog Entry

Fixed: JS error on Custom Results edit page

Credits

Props @burhandodhy

Checklist:

  • [x] 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.

burhandodhy avatar Aug 10 '22 11:08 burhandodhy