filter to add autosuggest styles while indexing #2842
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Changelog Entry
Added -
ep_autosuggest_styles_if_idexing
filter to enqueue autosuggest styles even if index is runningCredits
Props @hugosolar