From 7f17a7db791838c6524bd310024f88a87e0f950e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 2 Aug 2026 23:06:48 +0000 Subject: [PATCH] fix(campanha): B140 wire onCommitQuery + simplify import hygiene Co-authored-by: Francisco Solla --- src/components/campaign/demand/DemandFilters.tsx | 6 ++++-- src/utilities/demand/demandOmnibox.ts | 2 -- tests/int/campaignEntityListData.int.spec.ts | 7 +++++++ tests/unit/campaignEntityListParsers.unit.spec.ts | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/campaign/demand/DemandFilters.tsx b/src/components/campaign/demand/DemandFilters.tsx index 0240db86..fd739237 100644 --- a/src/components/campaign/demand/DemandFilters.tsx +++ b/src/components/campaign/demand/DemandFilters.tsx @@ -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 })) }} diff --git a/src/utilities/demand/demandOmnibox.ts b/src/utilities/demand/demandOmnibox.ts index c85b7041..4f90e323 100644 --- a/src/utilities/demand/demandOmnibox.ts +++ b/src/utilities/demand/demandOmnibox.ts @@ -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 } diff --git a/tests/int/campaignEntityListData.int.spec.ts b/tests/int/campaignEntityListData.int.spec.ts index 38669916..6f7b180a 100644 --- a/tests/int/campaignEntityListData.int.spec.ts +++ b/tests/int/campaignEntityListData.int.spec.ts @@ -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) }) }) diff --git a/tests/unit/campaignEntityListParsers.unit.spec.ts b/tests/unit/campaignEntityListParsers.unit.spec.ts index 40f8e35e..c7ac71e8 100644 --- a/tests/unit/campaignEntityListParsers.unit.spec.ts +++ b/tests/unit/campaignEntityListParsers.unit.spec.ts @@ -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