Skip to content

Commit

Permalink
fix(sanity): findability comment
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed May 1, 2024
1 parent 205b276 commit 3342213
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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}`,
],
Expand Down

0 comments on commit 3342213

Please sign in to comment.