Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not pin span in url for playground trace details slideover #5200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion app/src/pages/playground/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import React, { useEffect } from "react";
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import { useSearchParams } from "react-router-dom";
import { css } from "@emotion/react";

import {
Expand Down Expand Up @@ -40,6 +41,20 @@ const playgroundWrapCSS = css`

export function Playground(props: InitialPlaygroundState) {
const showStreamToggle = useFeatureFlag("playgroundNonStreaming");
const [, setSearchParams] = useSearchParams();

useEffect(() => {
setSearchParams(
(searchParams) => {
// remove lingering selectedSpanNodeId param so as to not poison the trace details slideover
// with stale data from previous pages
searchParams.delete("selectedSpanNodeId");
return searchParams;
},
{ replace: true }
);
}, [setSearchParams]);

return (
<PlaygroundProvider {...props}>
<div css={playgroundWrapCSS}>
Expand Down
6 changes: 5 additions & 1 deletion app/src/pages/playground/SpanPlaygroundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function SpanPlaygroundPage() {
return (
<Flex direction="column" height={"100%"}>
<SpanPlaygroundBanners span={span} parsingErrors={parsingErrors} />
<Playground instances={[playgroundInstance]} />
<Playground
// remount the playground when the span changes, resetting all local state, closing dialogs, etc.
key={span.id}
instances={[playgroundInstance]}
/>
</Flex>
);
}
Expand Down
Loading