Skip to content

Commit 0e519bb

Browse files
committed
remove dbSqlRowTableConfig from drawer url state
1 parent 490287a commit 0e519bb

File tree

7 files changed

+29051
-19881
lines changed

7 files changed

+29051
-19881
lines changed

packages/app/src/DBDashboardPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
985985
>
986986
+ Add New Tile
987987
</Button>
988+
988989
<RowSidePanels />
989990
</Box>
990991
);

packages/app/src/DBSearchPage.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -865,14 +865,9 @@ function DBSearchPage() {
865865
if (!searchedConfig.source) {
866866
return;
867867
}
868-
openRowSidePanel(
869-
searchedConfig.source,
870-
rowWhere,
871-
dbSqlRowTableConfig,
872-
true,
873-
);
868+
openRowSidePanel(searchedConfig.source, rowWhere, true);
874869
},
875-
[dbSqlRowTableConfig, openRowSidePanel, searchedConfig.source],
870+
[openRowSidePanel, searchedConfig.source],
876871
);
877872

878873
const searchFilters = useSearchPageFilterState({
@@ -1197,6 +1192,7 @@ function DBSearchPage() {
11971192
displayedColumns,
11981193
toggleColumn,
11991194
generateSearchUrl,
1195+
dbSqlRowTableConfig,
12001196
}}
12011197
>
12021198
<RowSidePanels />

packages/app/src/SessionSubpanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ export default function SessionSubpanel({
500500
queriedConfig={sessionEventListConfig}
501501
onClick={useCallback(
502502
(id: string) => {
503-
openRowSidePanel(traceSource.id, id, sessionEventListConfig);
503+
openRowSidePanel(traceSource.id, id);
504504
},
505-
[openRowSidePanel, sessionEventListConfig, traceSource.id],
505+
[openRowSidePanel, traceSource.id],
506506
)}
507507
focus={focus}
508508
onTimeClick={useCallback(

packages/app/src/components/ContextSidePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export default function ContextSubpanel({
153153
const { openRowSidePanel } = useRowSidePanel();
154154
const handleExpandLine = useCallback(
155155
(rowWhere: string) => {
156-
openRowSidePanel(source.id, rowWhere, dbSqlRowTableConfig);
156+
openRowSidePanel(source.id, rowWhere);
157157
},
158-
[dbSqlRowTableConfig, openRowSidePanel, source.id],
158+
[openRowSidePanel, source.id],
159159
);
160160

161161
return (

packages/app/src/components/DBRowSidePanel.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
createContext,
33
MouseEventHandler,
44
useCallback,
5+
useContext,
56
useMemo,
67
useState,
78
} from 'react';
@@ -55,7 +56,6 @@ export const RowSidePanelContext = createContext<{
5556
}>({});
5657

5758
type DBRowSidePanelProps = {
58-
dbSqlRowTableConfig?: ChartConfigWithDateRange;
5959
source: TSource;
6060
rowId: string | undefined;
6161
zIndexOffset?: number;
@@ -84,7 +84,6 @@ export default function DBRowSidePanelWithFetcher({
8484
function DBRowSidePanel({
8585
rowId,
8686
source,
87-
dbSqlRowTableConfig,
8887
onClose: _onClose,
8988
isTopPanel = true,
9089
zIndexOffset = 0,
@@ -214,6 +213,8 @@ function DBRowSidePanel({
214213
);
215214
}, [source, normalizedRow]);
216215

216+
const { dbSqlRowTableConfig } = useContext(RowSidePanelContext);
217+
217218
return (
218219
<Drawer
219220
customIdSuffix={`log-side-panel-${rowId}`}

packages/app/src/hooks/useRowSidePanel.tsx

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import React from 'react';
22
import produce from 'immer';
33
import { parseAsArrayOf, parseAsJson, useQueryState } from 'nuqs';
4-
import { ChartConfigWithDateRange } from '@hyperdx/common-utils/dist/types';
54

65
import DBRowSidePanel from '@/components/DBRowSidePanel';
76

87
type SidePanelState = {
98
sid: string;
109
rw: string;
11-
tcfg?: ChartConfigWithDateRange;
1210
};
1311

1412
type SidePanelStack = SidePanelState[];
1513

1614
export const useRowSidePanel = () => {
1715
const [sidePanelStack, setSidePanelStack] = useQueryState<SidePanelStack>(
18-
'drawer',
16+
'rowDetails',
1917
parseAsArrayOf(parseAsJson()),
2018
);
2119

@@ -54,13 +52,8 @@ export const useRowSidePanel = () => {
5452

5553
// Row Side Panel
5654
const openRowSidePanel = React.useCallback(
57-
(
58-
sid: string,
59-
rw: string,
60-
tcfg?: ChartConfigWithDateRange,
61-
replace?: boolean,
62-
) => {
63-
pushSidePanel({ sid, rw, tcfg }, replace);
55+
(sid: string, rw: string, replace?: boolean) => {
56+
pushSidePanel({ sid, rw }, replace);
6457
},
6558
[pushSidePanel],
6659
);
@@ -73,22 +66,21 @@ export const useRowSidePanel = () => {
7366
};
7467
};
7568

76-
export const RowSidePanels = () => {
69+
export const RowSidePanels: React.FC = () => {
7770
const { sidePanelStack, closeSidePanel } = useRowSidePanel();
7871

79-
if (!sidePanelStack) {
80-
return null;
81-
}
82-
83-
return sidePanelStack.map((sidePanel, index) => (
84-
<DBRowSidePanel
85-
key={index}
86-
onClose={() => closeSidePanel(index)}
87-
rowId={sidePanel.rw}
88-
sourceId={sidePanel.sid}
89-
zIndexOffset={index}
90-
dbSqlRowTableConfig={sidePanel.tcfg}
91-
isTopPanel={index === sidePanelStack.length - 1}
92-
/>
93-
));
72+
return (
73+
<>
74+
{sidePanelStack?.map((sidePanel, index) => (
75+
<DBRowSidePanel
76+
key={index}
77+
onClose={() => closeSidePanel(index)}
78+
rowId={sidePanel.rw}
79+
sourceId={sidePanel.sid}
80+
zIndexOffset={index}
81+
isTopPanel={index === sidePanelStack.length - 1}
82+
/>
83+
))}
84+
</>
85+
);
9486
};

0 commit comments

Comments
 (0)