-
Notifications
You must be signed in to change notification settings - Fork 313
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
Handle expired or missing tokens for orders autosuggest #3308
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JakePT during my tests on this one, at some point I didn't have a search template saved, and when I typed anything the request failed but then JS went in an infinite loop of requesting a token and trying again. Did you see that before?
Also, would it be possible to disable the browser's autosuggest? Chrome keeps adding its suggestions in front of the autosuggest list.
I've also pushed a few minor changes if you want to give it a look (including fixing some conflicts we got with develop after the Request ID inclusion.)
@felipeelia I have:
|
Description of the Change
Adds handling for missing or expired tokens. Now if an search fails a new token will be fetched and the search will be reattempted. This will handle situations where a token has expired. Refreshing a token will only be attempted once.
Additionally I've included a few fixes for the suggestion dropdown:
Closes #3296
How to test the Change
From #3175:
( new Orders() )->setup();
to thesetup()
method of the WooCommerce feature class.New:
wp-json/elasticpress/v1/token
should be sent and should return a token.wp_usermeta
, findep_token
for your user and manipulate it so that it's invalid.wp-json/elasticpress/v1/token
should be sent and should return the manipulated token.wp-json/elasticpress/v1/token
should be sent and should return a new token. Another API request to ElasticPress.io should follow and should succeed. Suggestions should now be offered in a listbox below the search form.Changelog Entry
See #3175
Credits
Props @JakePT
Checklist: