Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions spotlight/shared/shared-component-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ export class SharedSpotlightLogic {
static combineResults(instantSuggestion, asyncSuggestions) {
const combined = [];

// Add instant suggestion first (if exists)
if (instantSuggestion) {
combined.push(instantSuggestion);
}

// Add async suggestions, filtering out duplicates of the instant suggestion
for (const asyncResult of asyncSuggestions) {
const isDuplicate = instantSuggestion && SpotlightUtils.areResultsDuplicate(instantSuggestion, asyncResult);
Expand All @@ -38,6 +33,12 @@ export class SharedSpotlightLogic {
}
}

// Add instant suggestion second (or first if contains space) (if exists)
if (instantSuggestion) {
const first = instantSuggestion.metadata?.query?.match(/[^A-z]/);
combined.splice(first ? 0 : 1, 0, instantSuggestion);
}

return combined;
}

Expand Down Expand Up @@ -181,4 +182,4 @@ export class SharedSpotlightLogic {
}
};
}
}
}