Skip to content

Commit 5bdbf47

Browse files
authored
Run page improvements (#1874)
* When selecting spans, don’t add to the browser history * Only non-debug events can extend the total duration of the run timeline
1 parent 7591b6e commit 5bdbf47

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

apps/webapp/app/hooks/useReplaceSearchParams.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import { useSearchParams } from "@remix-run/react";
22
import { useCallback } from "react";
33

4+
type NavigateOptions = {
5+
replace?: boolean;
6+
preventScrollReset?: boolean;
7+
};
8+
49
export function useReplaceSearchParams() {
510
const [searchParams, setSearchParams] = useSearchParams();
611

712
const replaceSearchParam = useCallback(
8-
(key: string, value?: string) => {
13+
(key: string, value?: string, navigateOpts?: NavigateOptions) => {
914
setSearchParams((s) => {
1015
if (value) {
1116
s.set(key, value);
1217
} else {
1318
s.delete(key);
1419
}
1520
return s;
16-
});
21+
}, navigateOpts);
1722
},
1823
[searchParams]
1924
);

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ export class RunPresenter {
159159
const offset = millisecondsToNanoseconds(
160160
n.data.startTime.getTime() - treeRootStartTimeMs
161161
);
162-
totalDuration = Math.max(totalDuration, offset + n.data.duration);
162+
//only let non-debug events extend the total duration
163+
if (!n.data.isDebug) {
164+
totalDuration = Math.max(totalDuration, offset + n.data.duration);
165+
}
163166
return {
164167
...n,
165168
data: {

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function TraceView({ run, trace, maximumLiveReloadingSetting, resizable }: Loade
306306
const shouldLiveReload = events.length <= maximumLiveReloadingSetting;
307307

308308
const changeToSpan = useDebounce((selectedSpan: string) => {
309-
replaceSearchParam("span", selectedSpan);
309+
replaceSearchParam("span", selectedSpan, { replace: true });
310310
}, 250);
311311

312312
const revalidator = useRevalidator();

0 commit comments

Comments
 (0)