From 53e4cf43519ed7822375c61109f5bd7db4177141 Mon Sep 17 00:00:00 2001 From: Rafael Chen Date: Tue, 3 Nov 2026 17:45:43 -0500 Subject: [PATCH 01/11] feat(prospects): add a bounded pool for running work concurrently The pipeline researches candidates one at a time, and most of that time is spent waiting on other people's websites. This helper runs work a few at a time, keeps results in input order, and on a failure starts nothing new and waits for what already started, so a caller can mark a run failed knowing nothing is still writing. Co-Authored-By: Claude Opus 5.5 --- pipelines/src/distribution/pool.test.ts | 83 +++++++++++++++++++++++++ pipelines/src/distribution/pool.ts | 30 +++++++++ 2 files changed, 113 insertions(+) create mode 100644 pipelines/src/distribution/pool.test.ts create mode 100644 pipelines/src/distribution/pool.ts diff --git a/pipelines/src/distribution/pool.test.ts b/pipelines/src/distribution/pool.test.ts new file mode 100644 index 000000000..a797f8863 --- /dev/null +++ b/pipelines/src/distribution/pool.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, it } from "vitest"; + +import { mapInPool } from "./pool"; + +/** A promise the test finishes by hand, so overlap is exact rather than timed. */ +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +const tick = () => new Promise(resolve => setTimeout(resolve, 0)); + +describe("mapInPool", () => { + it("never runs more than the limit, and returns results in input order", async () => { + const gates = [0, 1, 2, 3, 4].map(() => deferred()); + const started: number[] = []; + const pending = mapInPool([0, 1, 2, 3, 4], 2, i => { + started.push(i); + return gates[i]!.promise; + }); + + await tick(); + expect(started).toEqual([0, 1]); + + // The later item finishes first; its slot goes to the next one. + gates[1]!.resolve("b"); + await tick(); + expect(started).toEqual([0, 1, 2]); + + gates[0]!.resolve("a"); + gates[2]!.resolve("c"); + gates[3]!.resolve("d"); + gates[4]!.resolve("e"); + await expect(pending).resolves.toEqual(["a", "b", "c", "d", "e"]); + }); + + it("starts nothing new after a failure, and waits for what started", async () => { + const gates = [0, 1, 2, 3].map(() => deferred()); + const started: number[] = []; + let settled = false; + const pending = mapInPool([0, 1, 2, 3], 2, i => { + started.push(i); + return gates[i]!.promise; + }).finally(() => { + settled = true; + }); + const outcome = expect(pending).rejects.toThrow("first"); + + await tick(); + gates[0]!.reject(new Error("first")); + await tick(); + expect(started).toEqual([0, 1]); + expect(settled).toBe(false); + + gates[1]!.resolve("b"); + await outcome; + expect(started).toEqual([0, 1]); + }); + + it("skips what has not started once stopped, keeping the finished results", async () => { + let stop = false; + const results = await mapInPool( + [0, 1, 2, 3], + 1, + async i => { + if (i === 1) stop = true; + return i; + }, + () => stop + ); + expect(results).toEqual([0, 1]); + }); + + it("treats a limit below one as one, and handles no items", async () => { + await expect(mapInPool([1, 2], 0, async i => i * 2)).resolves.toEqual([2, 4]); + await expect(mapInPool([], 5, async i => i)).resolves.toEqual([]); + }); +}); diff --git a/pipelines/src/distribution/pool.ts b/pipelines/src/distribution/pool.ts new file mode 100644 index 000000000..94daa08f6 --- /dev/null +++ b/pipelines/src/distribution/pool.ts @@ -0,0 +1,30 @@ +/** + * Run `fn` over `items`, at most `limit` at a time, with results in input + * order. A failure starts nothing new, lets what already started finish, then + * rejects with the first error, so a caller can mark the run failed knowing + * nothing is still writing. `stopped` is checked before each item starts; + * items it skips have no result. + */ +export async function mapInPool( + items: readonly T[], + limit: number, + fn: (item: T) => Promise, + stopped?: () => boolean +): Promise { + const results: Array<{ value: R }> = []; + let next = 0; + let failure: { error: unknown } | null = null; + const worker = async () => { + while (next < items.length && !failure && !stopped?.()) { + const index = next++; + try { + results[index] = { value: await fn(items[index]!) }; + } catch (error) { + failure ??= { error }; + } + } + }; + await Promise.all(Array.from({ length: Math.max(1, limit) }, worker)); + if (failure) throw (failure as { error: unknown }).error; + return results.flatMap(result => (result ? [result.value] : [])); +} From 3fffb4737dbe4f03295bd048095ea842974d32dd Mon Sep 17 00:00:00 2001 From: Rafael Chen Date: Tue, 3 Nov 2026 17:45:43 -0500 Subject: [PATCH 02/11] feat(prospects): read five companies at once in keyless runs Finding prospects spent about 5s per company reading websites one company at a time. Measured on 15 real sites, reading five at once took 74.8s down to 14.4s with identical dossiers and pages on all 15. Each company's own site is still read one page at a time, so no site sees more load. The limit is a new optional enrichConcurrency port that defaults to one, so fixture runs are unchanged. The worker's durable job schedules its own steps and does not use it. Co-Authored-By: Claude Opus 5.5 --- .changeset/prospects-parallel-reading.md | 8 ++ .../src/distribution/keyless/keyless.test.ts | 1 + pipelines/src/distribution/keyless/ports.ts | 7 ++ pipelines/src/distribution/run.test.ts | 106 +++++++++++++++++- pipelines/src/distribution/run.ts | 21 ++-- 5 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 .changeset/prospects-parallel-reading.md diff --git a/.changeset/prospects-parallel-reading.md b/.changeset/prospects-parallel-reading.md new file mode 100644 index 000000000..3fff1852b --- /dev/null +++ b/.changeset/prospects-parallel-reading.md @@ -0,0 +1,8 @@ +--- +"@launchstack/pipelines": patch +--- + +Keyless runs read five companies at once instead of one after another, through +a new optional `enrichConcurrency` on `DistributionPorts`. Each company's own +site is still read one page at a time. Fixture runs and the worker's durable +job are unchanged. diff --git a/pipelines/src/distribution/keyless/keyless.test.ts b/pipelines/src/distribution/keyless/keyless.test.ts index 55c124e0c..b6fa23936 100644 --- a/pipelines/src/distribution/keyless/keyless.test.ts +++ b/pipelines/src/distribution/keyless/keyless.test.ts @@ -757,6 +757,7 @@ describe("keyless ports", () => { expect(ports.creditsPerCandidate).toBe(0); expect(ports.compliance).toBeNull(); expect(ports.profile).toBeDefined(); + expect(ports.enrichConcurrency).toBe(5); await expect( ports.model.respond({ system: "", transcript: [], tools: [] }) ).rejects.toThrow(/no model/); diff --git a/pipelines/src/distribution/keyless/ports.ts b/pipelines/src/distribution/keyless/ports.ts index f892cc121..ec88989fc 100644 --- a/pipelines/src/distribution/keyless/ports.ts +++ b/pipelines/src/distribution/keyless/ports.ts @@ -52,6 +52,12 @@ export interface KeylessPortsOptions { pagesPerCandidate?: number; } +/** + * Companies read at once. Most of a run is waiting on other people's websites, + * and each is a different site, so what is read from each does not change. + */ +const ENRICH_CONCURRENCY = 5; + const noModel: AgentModelPort = { respond: () => Promise.reject( @@ -164,6 +170,7 @@ export function createKeylessPorts(options: KeylessPortsOptions = {}): Distribut creditsPerCandidate: 0, embed: options.embed ?? null, judgeFit: options.judgeFit ?? null, + enrichConcurrency: ENRICH_CONCURRENCY, plan: async input => ({ plan: await buildKeylessPlan(input, { embed: options.embed ?? null, diff --git a/pipelines/src/distribution/run.test.ts b/pipelines/src/distribution/run.test.ts index cb13c1202..0f59e2a8c 100644 --- a/pipelines/src/distribution/run.test.ts +++ b/pipelines/src/distribution/run.test.ts @@ -19,6 +19,8 @@ const store = vi.hoisted(() => ({ won: [] as string[], upserted: [] as ResolvedOrg[], wonCalls: 0, + statuses: [] as string[], + relationships: new Map(), })); vi.mock("@launchstack/tools/company-context", () => ({ @@ -37,7 +39,9 @@ vi.mock("@launchstack/tools/company-context", () => ({ vi.mock("./db", () => ({ getProgram: async () => store.program, getRun: async () => store.run, - updateRun: async () => undefined, + updateRun: async (_id: string, _companyId: bigint, patch: { status?: string }) => { + if (patch.status) store.statuses.push(patch.status); + }, listExclusions: async () => store.exclusions, listWonDomains: async () => { store.wonCalls += 1; @@ -53,11 +57,35 @@ vi.mock("./db", () => ({ items, }: { items: Array<{ orgId: string; kind: string }>; - }) => items.map((item, i) => ({ id: `rel-${i}`, ...item, stage: "lead" })), + }) => { + const rows = items.map((item, i) => ({ id: `rel-${i}`, ...item, stage: "lead" })); + for (const row of rows) store.relationships.set(row.id, row); + return rows; + }, + getRelationship: async (id: string) => ({ + ...store.relationships.get(id), + territory: { country: "NL" }, + }), + getOrg: async (id: string) => ({ + id, + name: id, + domain: `${id}.example`, + country: "NL", + region: null, + city: null, + roles: [], + categories: [], + description: null, + sizeBand: null, + kgEntityId: 1, + }), + listEvidenceForOrg: async () => [], + setResearchResult: async () => undefined, + addEvent: async () => undefined, })); import { createFixturePorts } from "./fixture"; -import { prepareRun, type DistributionPorts } from "./run"; +import { prepareRun, runDistributionPipeline, type DistributionPorts } from "./run"; const program = { id: "prog-1", @@ -178,6 +206,8 @@ beforeEach(() => { store.won = ["won.example"]; store.upserted = []; store.wonCalls = 0; + store.statuses = []; + store.relationships = new Map(); }); describe("prepareRun discovery", () => { @@ -317,3 +347,73 @@ describe("prepareRun discovery", () => { expect(store.upserted.some(o => o.domain !== null && NEVER.includes(o.domain))).toBe(false); }); }); + +describe("runDistributionPipeline research", () => { + /** Ports over `count` companies whose research records how many ran at once. */ + function trackingPorts( + count: number, + onProfile: (orgId: string) => void = () => undefined + ): { ports: DistributionPorts; seen: { peak: number; orgs: string[] } } { + const seen = { peak: 0, orgs: [] as string[] }; + let running = 0; + const ports: DistributionPorts = { + ...livePorts({ described: [], searches: [] }), + searchCompanies: async query => + query.startsWith("Companies similar to") + ? [] + : Array.from({ length: count }, (_, i) => + hit(`firm-${i}.example`, `Fulfilment Firm ${i}`) + ), + profile: async (_ports, input) => { + running += 1; + seen.peak = Math.max(seen.peak, running); + seen.orgs.push(input.org.id); + await new Promise(resolve => setTimeout(resolve, 1)); + running -= 1; + onProfile(input.org.id); + return { + outcome: { status: "gate_failed", dossier: null, errors: [] }, + evidence: [], + fetchedUrls: [], + turns: 0, + usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 }, + modelId: "test", + playbookHash: "test", + promptVersion: "test", + }; + }, + }; + return { ports, seen }; + } + + it("researches every candidate once, up to the ports' limit at a time", async () => { + const { ports, seen } = trackingPorts(12); + const summary = await runDistributionPipeline(ctx, { ...ports, enrichConcurrency: 3 }); + + expect(seen.peak).toBe(3); + expect(new Set(seen.orgs).size).toBe(12); + expect(seen.orgs).toHaveLength(12); + expect(summary.shortlisted).toBe(12); + expect(summary.gateRejections).toBe(12); + expect(store.statuses.at(-1)).toBe("completed"); + }); + + it("stays one at a time when the ports set no limit", async () => { + const { ports, seen } = trackingPorts(4); + await runDistributionPipeline(ctx, ports); + expect(seen.peak).toBe(1); + expect(seen.orgs).toHaveLength(4); + }); + + it("marks the run failed and starts no one else when a candidate throws", async () => { + const { ports, seen } = trackingPorts(12, orgId => { + if (orgId === seen.orgs[0]) throw new Error("database went away"); + }); + await expect( + runDistributionPipeline(ctx, { ...ports, enrichConcurrency: 3 }) + ).rejects.toThrow("database went away"); + + expect(seen.orgs.length).toBeLessThan(12); + expect(store.statuses.at(-1)).toBe("failed"); + }); +}); diff --git a/pipelines/src/distribution/run.ts b/pipelines/src/distribution/run.ts index b1568aff7..8a5c1c744 100644 --- a/pipelines/src/distribution/run.ts +++ b/pipelines/src/distribution/run.ts @@ -40,6 +40,7 @@ import { type SearchCompaniesPort, } from "./gather"; import { planDiscovery, type PlanInput, type SellerProfile } from "./plan"; +import { mapInPool } from "./pool"; import { makeDossierCreationKey, makeDossierFilename, renderDossierMarkdown } from "./render"; import { bestTerritoryFit, placeLabel } from "./locate"; import { buildRationaleInput, computeFit, deriveRiskFlags, templateRationale } from "./score"; @@ -153,6 +154,12 @@ export interface DistributionPorts { embed?: EmbedTexts | null; /** Chat-model check of the closest companies; null or absent → none. */ judgeFit?: JudgeFit | null; + /** + * Candidates `runDistributionPipeline` researches at once; absent → one at + * a time. Each is a different company, so its own site's requests still + * come one after another. A durable host schedules its own steps instead. + */ + enrichConcurrency?: number; } /** Companies the model checks per open shortlist place, each round down the ranking. */ @@ -924,13 +931,13 @@ export async function runDistributionPipeline( const startedAt = new Date(); try { const prepared = await prepareRun(ctx, ports); - const enriched: EnrichCandidateResult[] = []; - for (const relationshipId of prepared.candidateRelationshipIds) { - if (ctx.signal?.aborted) break; - enriched.push( - await enrichCandidate(ctx, ports, { relationshipId, profile: prepared.profile }) - ); - } + const enriched = await mapInPool( + prepared.candidateRelationshipIds, + ports.enrichConcurrency ?? 1, + relationshipId => + enrichCandidate(ctx, ports, { relationshipId, profile: prepared.profile }), + () => ctx.signal?.aborted ?? false + ); return await finalizeRun(ctx, prepared, enriched, startedAt); } catch (error) { await failRun(ctx, error instanceof Error ? error.message : String(error)); From f982ce0b188325705c0d8faab41000067d8e622d Mon Sep 17 00:00:00 2001 From: Rafael Chen Date: Fri, 13 Nov 2026 15:24:35 -0500 Subject: [PATCH 03/11] perf(prospects): show the last result at once when switching back to a screen Every switch between Prospects screens remounted the screen and refetched from a skeleton, and the server rebuilt the whole segment each time. useResource gains an opt-in keepAcrossMounts: the last result per key is kept for the page load, shown immediately, and refreshed in the background. Turned on for the Prospects screens. Co-Authored-By: Claude Opus 5.5 --- .../__tests__/lib/tools/useResource.test.tsx | 66 +++++++++++++++++++ .../prospects/_screens/CompaniesScreen.tsx | 15 +++-- .../prospects/_screens/CompanyScreen.tsx | 10 +-- .../growth/prospects/_screens/DealsScreen.tsx | 6 +- .../growth/prospects/_screens/HomeScreen.tsx | 6 +- .../prospects/_screens/PeopleScreen.tsx | 15 +++-- .../growth/prospects/_screens/RunsScreen.tsx | 1 + .../prospects/_screens/SegmentScreen.tsx | 10 +-- .../prospects/_screens/SourcesScreen.tsx | 10 +-- apps/web/src/lib/tools/useResource.ts | 46 +++++++++++-- 10 files changed, 151 insertions(+), 34 deletions(-) create mode 100644 apps/web/__tests__/lib/tools/useResource.test.tsx diff --git a/apps/web/__tests__/lib/tools/useResource.test.tsx b/apps/web/__tests__/lib/tools/useResource.test.tsx new file mode 100644 index 000000000..068dc4d44 --- /dev/null +++ b/apps/web/__tests__/lib/tools/useResource.test.tsx @@ -0,0 +1,66 @@ +/** @jest-environment jsdom */ +import { act, renderHook, waitFor } from "@testing-library/react"; + +jest.mock("next-intl", () => ({ useTranslations: () => (key: string) => key })); +jest.mock("~/lib/tools/errorText", () => ({ + useErrorText: () => (_e: unknown, fallback: string) => fallback, +})); + +import { forgetResources, useResource } from "~/lib/tools/useResource"; + +beforeEach(() => forgetResources()); + +describe("useResource across a remount", () => { + it("shows what it last loaded at once, and refreshes it in the background", async () => { + let n = 0; + const fetcher = jest.fn(async () => ({ n: ++n })); + const first = renderHook(() => + useResource("companies:seg-1", fetcher, { keepAcrossMounts: true }) + ); + expect(first.result.current.loading).toBe(true); + await waitFor(() => expect(first.result.current.data).toEqual({ n: 1 })); + first.unmount(); + + // A tab switch away and back: the screen mounts again. + const second = renderHook(() => + useResource("companies:seg-1", fetcher, { keepAcrossMounts: true }) + ); + expect(second.result.current.loading).toBe(false); + expect(second.result.current.data).toEqual({ n: 1 }); + await waitFor(() => expect(second.result.current.data).toEqual({ n: 2 })); + expect(fetcher).toHaveBeenCalledTimes(2); + }); + + it("starts from a skeleton without the option, as before", async () => { + const fetcher = jest.fn(async () => "x"); + const first = renderHook(() => useResource("deals:seg-1", fetcher)); + await waitFor(() => expect(first.result.current.data).toBe("x")); + first.unmount(); + const second = renderHook(() => useResource("deals:seg-1", fetcher)); + expect(second.result.current.loading).toBe(true); + expect(second.result.current.data).toBeNull(); + }); + + it("keeps an optimistic change for the next mount, and keys stay apart", async () => { + const fetcher = jest.fn(async () => ({ stage: "lead" })); + const first = renderHook(() => + useResource("company:a", fetcher, { keepAcrossMounts: true }) + ); + await waitFor(() => expect(first.result.current.data).toEqual({ stage: "lead" })); + act(() => first.result.current.mutate(() => ({ stage: "won" }))); + first.unmount(); + const again = renderHook(() => + useResource("company:a", () => new Promise(() => undefined), { + keepAcrossMounts: true, + }) + ); + expect(again.result.current.data).toEqual({ stage: "won" }); + const other = renderHook(() => + useResource("company:b", () => new Promise(() => undefined), { + keepAcrossMounts: true, + }) + ); + expect(other.result.current.data).toBeNull(); + expect(other.result.current.loading).toBe(true); + }); +}); diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/CompaniesScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/CompaniesScreen.tsx index fa0c63371..34c0d6fdb 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/CompaniesScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/CompaniesScreen.tsx @@ -107,7 +107,8 @@ export function CompaniesScreen() { const list = useResource( segmentId ? `companies:${segmentId}:${view}:${sort}:${query}` : null, - () => prospectsApi.companies({ segmentId: segmentId!, view, sort, q: query }) + () => prospectsApi.companies({ segmentId: segmentId!, view, sort, q: query }), + { keepAcrossMounts: true } ); const finished = activeRun?.status === "completed"; const reload = list.reload; @@ -304,16 +305,16 @@ export function CompaniesScreen() { ))}
- + setDraft(e.target.value)} placeholder={t("companies.search")} aria-label={t("companies.search")} - className="h-8 w-[240px] pl-8 pr-8 text-[13px]" + className="h-8 w-[240px] pr-8 pl-8 text-[13px]" /> - + /
@@ -500,7 +501,7 @@ function CompanyTableRow({ onCheckedChange={onToggle} /> - + - + {word(c.whyCopy, c.why)} {c.excluded && c.excludedReason && ( @@ -535,7 +536,7 @@ function CompanyTableRow({ {c.people} - + {c.isNew ? t("companies.foundInLastRun") : relativeTime(c.lastActivityAt)} diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/CompanyScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/CompanyScreen.tsx index 1e4d48ed1..95194a640 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/CompanyScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/CompanyScreen.tsx @@ -95,7 +95,9 @@ export function CompanyScreen({ id }: { id: string }) { const { href } = useProspects(); const router = useToolRouter(); const active = useToolActive(); - const res = useResource(`company:${id}`, () => prospectsApi.company(id)); + const res = useResource(`company:${id}`, () => prospectsApi.company(id), { + keepAcrossMounts: true, + }); const c = res.data?.company ?? null; const [outreachOpen, setOutreachOpen] = useState(false); const [nextStep, setNextStep] = useState(""); @@ -219,7 +221,7 @@ export function CompanyScreen({ id }: { id: string }) { )} -
+

{c ? c.name : } @@ -249,7 +251,7 @@ export function CompanyScreen({ id }: { id: string }) { )}

{c && ( -
+
)} -
+
{!c ? ( <> diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/DealsScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/DealsScreen.tsx index d5f35855a..96ac186c5 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/DealsScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/DealsScreen.tsx @@ -29,8 +29,10 @@ export function DealsScreen() { const ts = useTranslations("growth.server"); const errorText = useErrorText(); const { segmentId, href } = useProspects(); - const res = useResource(segmentId ? `deals:${segmentId}` : null, () => - prospectsApi.deals(segmentId!) + const res = useResource( + segmentId ? `deals:${segmentId}` : null, + () => prospectsApi.deals(segmentId!), + { keepAcrossMounts: true } ); const deals = useMemo(() => res.data?.deals ?? [], [res.data]); const byStage = useMemo(() => { diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/HomeScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/HomeScreen.tsx index e9dd09696..523037f50 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/HomeScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/HomeScreen.tsx @@ -72,8 +72,10 @@ export function HomeScreen() { const segmentText = useSegmentText(); const errorText = useErrorText(); const { segmentId, href, startRun, activeRun, segments, segmentsLoading } = useProspects(); - const home = useResource(segmentId ? `home:${segmentId}` : null, () => - prospectsApi.home(segmentId!) + const home = useResource( + segmentId ? `home:${segmentId}` : null, + () => prospectsApi.home(segmentId!), + { keepAcrossMounts: true } ); const finished = activeRun?.status === "completed"; const reload = home.reload; diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/PeopleScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/PeopleScreen.tsx index dd49c008c..1ca19dd0c 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/PeopleScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/PeopleScreen.tsx @@ -47,12 +47,15 @@ export function PeopleScreen() { return () => window.clearTimeout(id); }, [q]); - const res = useResource(segmentId ? `people:${segmentId}:${status}:${debounced}` : null, () => - prospectsApi.people({ - segmentId: segmentId!, - q: debounced || undefined, - status: status === "all" ? undefined : status, - }) + const res = useResource( + segmentId ? `people:${segmentId}:${status}:${debounced}` : null, + () => + prospectsApi.people({ + segmentId: segmentId!, + q: debounced || undefined, + status: status === "all" ? undefined : status, + }), + { keepAcrossMounts: true } ); const people = useMemo(() => res.data?.people ?? [], [res.data]); const [selected, setSelected] = useState>(new Set()); diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/RunsScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/RunsScreen.tsx index 8146746a1..d4dd46d46 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/RunsScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/RunsScreen.tsx @@ -127,6 +127,7 @@ export function RunsScreen() { () => prospectsApi.runs(segmentId!), { pollMs: activeRun && runIsLive(activeRun) ? 2000 : null, + keepAcrossMounts: true, } ); const finished = activeRun?.status === "completed" || activeRun?.status === "stopped"; diff --git a/apps/web/src/app/employer/tools/growth/prospects/_screens/SegmentScreen.tsx b/apps/web/src/app/employer/tools/growth/prospects/_screens/SegmentScreen.tsx index d58f0db68..566f249f4 100644 --- a/apps/web/src/app/employer/tools/growth/prospects/_screens/SegmentScreen.tsx +++ b/apps/web/src/app/employer/tools/growth/prospects/_screens/SegmentScreen.tsx @@ -62,7 +62,7 @@ function FieldRow({ }; return ( -
+
{label}
{editing ? ( @@ -134,7 +134,7 @@ function FieldRow({
)}
-
+
{field.editable && !editing && (