fix(campanha): B140 wire onCommitQuery + simplify import hygiene

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-08-02 23:06:48 +00:00
parent 59206574e6
commit 7f17a7db79
No known key found for this signature in database
4 changed files with 12 additions and 5 deletions

View file

@ -4,7 +4,7 @@ import { useMemo, useState } from 'react'
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
import { buildDemandListHref } from '@/utilities/demand/demandListUrl'
import { buildDemandListHref, type DemandListState } from '@/utilities/demand/demandListUrl'
import {
applyDemandOmniboxSuggestion,
buildDemandOmniboxChips,
@ -12,7 +12,6 @@ import {
clearDemandOmnibox,
filterDemandOmniboxSuggestions,
removeDemandOmniboxChip,
type DemandListState,
type DemandOmniboxAction,
} from '@/utilities/demand/demandOmnibox'
@ -60,6 +59,9 @@ export const DemandFilters = ({ state }: { state: DemandListState }) => {
onSelectSuggestion={(suggestionId) => {
runAction(applyDemandOmniboxSuggestion({ state, suggestionId }))
}}
onCommitQuery={(text) => {
runAction(applyDemandOmniboxSuggestion({ state, suggestionId: `q:${text}` }))
}}
onRemoveChip={(chipId) => {
runAction(removeDemandOmniboxChip({ state, chipId }))
}}

View file

@ -18,8 +18,6 @@ import {
} from '@/lib/schemas/campaignDemand'
import type { DemandListState } from '@/utilities/demand/demandListUrl'
export type { DemandListState }
export type DemandOmniboxAction =
| { kind: 'url'; state: DemandListState }
| { kind: 'clear'; state: DemandListState }

View file

@ -485,6 +485,13 @@ describe('loadDemandListPageData', () => {
})
expect(requesterHits.rows.some((row) => row.slug === byRequester.slug)).toBe(true)
expect(requesterHits.rows.some((row) => row.slug === byTitle.slug)).toBe(false)
const noMatch = await loadDemandListPageData(payload, coordinator, {
page: 1,
q: 'zzznomatch',
})
expect(noMatch.rows.some((row) => row.slug === byTitle.slug)).toBe(false)
expect(noMatch.rows.some((row) => row.slug === byRequester.slug)).toBe(false)
})
})

View file

@ -8,7 +8,7 @@
import { describe, expect, it } from 'vitest'
import { advisorListHrefForPage, parseAdvisorListParams } from '@/utilities/advisorData'
import { parseDemandListParams } from '@/utilities/campaignDemandData'
import { parseDemandListParams } from '@/utilities/demand/demandListUrl'
import { parseOrganizationListParams } from '@/utilities/organizationData'
const qAndPageParsers = [['advisor', parseAdvisorListParams]] as const