Skip to content

Commit 76c8303

Browse files
committed
feat(webapp): keep smart-column values fresh in the runs live poll
The 3s poll now carries the payload/metadata/output a smart column reads, so custom column values update in place instead of only on a full page load.
1 parent 6a18301 commit 76c8303

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

apps/webapp/app/presenters/v3/mapRunToLiveFields.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ export function mapRunToLiveFields(run: ListedRun) {
1919
usageDurationMs: Number(run.usageDurationMs),
2020
costInCents: run.costInCents,
2121
baseCostInCents: run.baseCostInCents,
22+
metadata: run.metadata,
23+
metadataType: run.metadataType,
24+
payload: run.payload,
25+
payloadType: run.payloadType,
26+
output: run.output,
27+
outputType: run.outputType,
2228
};
2329
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/useRunsLiveReload.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ function patchVisibleRunsWithLiveUpdates(currentRuns: ListedRun[], liveRuns: Liv
8787
usageDurationMs: update.usageDurationMs,
8888
costInCents: update.costInCents,
8989
baseCostInCents: update.baseCostInCents,
90+
metadata: update.metadata ?? run.metadata,
91+
metadataType: update.metadataType ?? run.metadataType,
92+
payload: update.payload ?? run.payload,
93+
payloadType: update.payloadType ?? run.payloadType,
94+
output: update.output ?? run.output,
95+
outputType: update.outputType ?? run.outputType,
9096
};
9197
});
9298
}
@@ -242,6 +248,10 @@ export function useRunsLiveReload({
242248
searchParams.set("runIds", activeRunIdsParam);
243249
}
244250

251+
const locationParams = new URLSearchParams(location.search);
252+
for (const col of locationParams.getAll("cols")) searchParams.append("cols", col);
253+
for (const smart of locationParams.getAll("sc")) searchParams.append("sc", smart);
254+
245255
if (checkForNewRuns) {
246256
appendNewRunsSearchParams(searchParams, {
247257
locationSearch: location.search,

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.live.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { clickhouseFactory } from "~/services/clickhouse/clickhouseFactoryInstan
77
import { loadProjectEnvironmentFromRequest } from "~/services/loadProjectEnvironmentFromRequest.server";
88
import { RunsRepository } from "~/services/runsRepository/runsRepository.server";
99
import { runIdsQueryParam } from "~/utils/searchParams";
10+
import { deriveRunSelect } from "~/components/runs/v3/runColumns";
11+
import { getRunColumnsForSelect } from "~/presenters/v3/runColumnsFromRequest.server";
1012

1113
const SearchParamsSchema = z.object({
1214
runIds: runIdsQueryParam,
@@ -36,6 +38,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
3638
"runsList"
3739
);
3840
const runsRepository = new RunsRepository({ clickhouse, prisma: $replica });
41+
const columns = getRunColumnsForSelect(request);
3942

4043
const [runs, newRunsResult] = await Promise.all([
4144
runIds.length > 0
@@ -45,6 +48,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
4548
projectId: project.id,
4649
environmentId: environment.id,
4750
runId: runIds,
51+
runSelect: deriveRunSelect(columns.visibleStandardIds, columns.smartSources),
4852
page: { size: 100 },
4953
})
5054
.then(({ runs: listedRuns }) => listedRuns.map(mapRunToLiveFields))

0 commit comments

Comments
 (0)