-
Notifications
You must be signed in to change notification settings - Fork 117
Fix autocomplete bottom links #1066
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
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.
Good initiative, @damcou! I added 2 comments.
if (keys.length > 1) { | ||
ors += ', <span><a href="' + keys[1].url + '">' + keys[1].key + '</a></span>'; | ||
if (isCategoryFacetEnabled) { | ||
if (keys.length > 0) { |
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.
Can those 2 conditions be replaced by a cycle?
@@ -336,12 +336,21 @@ document.addEventListener("DOMContentLoaded", function (e) { | |||
|
|||
var ors = ''; | |||
|
|||
if (keys.length > 0) { | |||
ors += '<span><a href="' + keys[0].url + '">' + keys[0].key + '</a></span>'; | |||
var isCategoryFacetEnabled = false; |
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.
Right now, the conditions happening no matter if there are some keys
or not, which is not super effective. Can it be run only if some keys are present? Or can keys
be retrieved only if categories are in facets? It's not effective to do both :)
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.
Thanks @damcou! I noticed one more thing - added to a comment.
ors += ', <span><a href="' + keys[1].url + '">' + keys[1].key + '</a></span>'; | ||
var orsTab = []; | ||
for (var i = 0; i<algoliaConfig.facets.length; i++) { | ||
if (algoliaConfig.facets[i].attribute == "categories") { |
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.
The if
and for
to check if categories are present are redundant to for
on line 324. It's already checked that categories are present. If they wouldn't, keys
would be an empty array.
So lines 341, 342, 347 (break;
) can be removed.
At the same time, could you add spaces to for
arguments?:
for (var i = 0; i < keys.length && i < 2 ; i++)
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.
LGTM
* master: (39 commits) Bump to 1.15.0 (algolia#1088) Fix error with configuration save while query rules are disabled in Algolia engine (algolia#1077) Fix special prices when customer groups are enabled (algolia#1071) Fix autocomplete bottom links (algolia#1066) update version number on mysql upgrade file update grid default direction asc on jobId Exclude non-salable subproducts from price calculation (algolia#1075) Improve name of "Remove inactive products" indexer (algolia#1054) Bump to 1.14.1 (algolia#1073) Remove color facet query rule (algolia#1072) PR updates - add view action link for indexing queue grid and add additional job methods to the list match updated logging in queue feedback fixes and add archive table long form array update indexing queue statuses notification Indexing Queue Status preliminary update to indexing queue job view add clearQueue method to Queue model and add preliminary viewAction for queue/job item view preliminary indexing queue controller, block, entity update getQueueInfo method for readable structure ...
Remove "ors" category links when the categories facet is not active