From 3342213dac5c2f9076a9e442372825d3be3f7d4d Mon Sep 17 00:00:00 2001 From: Ash Date: Wed, 1 May 2024 12:44:18 +0100 Subject: [PATCH] fix(sanity): findability comment --- .../navbar/search/contexts/search/SearchProvider.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/sanity/src/core/studio/components/navbar/search/contexts/search/SearchProvider.tsx b/packages/sanity/src/core/studio/components/navbar/search/contexts/search/SearchProvider.tsx index bcfb8eb4fad..4a4082f9299 100644 --- a/packages/sanity/src/core/studio/components/navbar/search/contexts/search/SearchProvider.tsx +++ b/packages/sanity/src/core/studio/components/navbar/search/contexts/search/SearchProvider.tsx @@ -120,9 +120,13 @@ export function SearchProvider({children, fullscreen}: SearchProviderProps) { const termsChanged = !isEqual(terms, previousTermsRef.current) if (orderingChanged || cursorChanged || termsChanged) { - // Use a custom label if provided, otherwise return field and direction, e.g. `_updatedAt desc` - const sortLabel = - ordering?.customMeasurementLabel || `${ordering.sort.field} ${ordering.sort.direction}` + let sortLabel = 'findability-sort:' + + if (ordering?.customMeasurementLabel || ordering.sort) { + // Use a custom label if provided, otherwise return field and direction, e.g. `_updatedAt desc` + sortLabel += + ordering?.customMeasurementLabel || `${ordering.sort?.field} ${ordering.sort?.direction}` + } handleSearch({ options: { @@ -132,7 +136,7 @@ export function SearchProvider({children, fullscreen}: SearchProviderProps) { ? [`findability-recent-search:${terms.__recent.index}`] : []), `findability-selected-types:${terms.types.length}`, - `findability-sort:${sortLabel}`, + sortLabel, `findability-source: global`, `findability-filter-count:${completeFilters.length}`, ],