ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

filter to add autosuggest styles while indexing

Open hugosolar opened this issue 2 years ago • 0 comments

Description of the Change

The filter ep_autosuggest_styles_if_idexing should allow enqueueing autosuggest styles even if the website is being reindexed. We have a project where we rely on those styles on the frontend but we're not relying on the ElasticPress built-in endpoint for autosuggest so not having those styles break the site appearance

Closes #2841

Alternate Designs

For now, we add a fix at the theme level where we're enqueuing the styles if are not enqueued but I think it could be helpful to force the styles if it's needed using a filter

Possible Drawbacks

since this change was introduced as a fix to a JS error, there are no possible side-effects since are just the styles

Verification Process

Fork the project and test my branch in my local environment. Ran a full site reindex and then test the filter is working properly

Checklist:

  • [x] I have read the CONTRIBUTING document.
  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my change.
  • [ ] All new and existing tests passed.

Changelog Entry

Added - ep_autosuggest_styles_if_idexing filter to enqueue autosuggest styles even if index is running

Credits

Props @hugosolar

hugosolar avatar Jun 16 '22 17:06 hugosolar