diff --git a/spotlight/shared/shared-component-logic.js b/spotlight/shared/shared-component-logic.js index 4cc40fc..c5e02af 100644 --- a/spotlight/shared/shared-component-logic.js +++ b/spotlight/shared/shared-component-logic.js @@ -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); @@ -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; } @@ -181,4 +182,4 @@ export class SharedSpotlightLogic { } }; } -} \ No newline at end of file +}