Skip to content

Commit ddc7dd0

Browse files
Improve Search Result Side Panel to fix various bugs (#1587)
1. Ensures that multiple scrollbars are not shown for nested panels (click row -> surrounding context -> repeat a few times) <img width="1402" height="876" alt="scrollbars" src="https://github.com/user-attachments/assets/f41c99e5-5fcb-47fa-9c40-243dbd926291" /> 2. In the same state as above, closing the panel (clicking outside) then clicking another row caused the subpanel to re-open, this isn't ideal (should open to root drawer) 3. fix issue with drawers where you can scroll, then open a nested drawer, the nested drawer would appear incorrectly <img width="910" height="878" alt="Screenshot 2026-01-09 at 5 10 29 PM" src="https://github.com/user-attachments/assets/fd1fbc0c-4453-46fb-b310-2323ec2792e2" /> Fixes HDX-3171
1 parent 5b25221 commit ddc7dd0

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎.changeset/fast-jokes-lay.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
various improvements to search result drawers and nesting logic

‎packages/app/src/components/ContextSidePanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface ContextSubpanelProps {
4444
}
4545

4646
// Custom hook to manage nested panel state
47-
function useNestedPanelState(isNested: boolean) {
47+
export function useNestedPanelState(isNested?: boolean) {
4848
// Query state (URL-based) for root level
4949
const queryState = {
5050
contextRowId: useQueryState('contextRowId', parseAsString),

‎packages/app/src/components/DBRowSidePanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ export default function DBRowSidePanelErrorBoundary({
559559
<Drawer
560560
opened={rowId != null}
561561
withCloseButton={false}
562-
withinPortal={!isNestedPanel}
562+
withOverlay={!isNestedPanel}
563563
onClose={() => {
564564
if (!subDrawerOpen) {
565565
_onClose();

‎packages/app/src/components/DBSqlRowTableWithSidebar.tsx‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useSource } from '@/source';
1111
import TabBar from '@/TabBar';
1212
import { useLocalStorage } from '@/utils';
1313

14+
import { useNestedPanelState } from './ContextSidePanel';
1415
import { RowDataPanel } from './DBRowDataPanel';
1516
import { RowOverviewPanel } from './DBRowOverviewPanel';
1617
import DBRowSidePanel, {
@@ -60,6 +61,7 @@ export default function DBSqlRowTableWithSideBar({
6061
const { data: sourceData } = useSource({ id: sourceId });
6162
const [rowId, setRowId] = useQueryState('rowWhere');
6263
const [rowSource, setRowSource] = useQueryState('rowSource');
64+
const { setContextRowId, setContextRowSource } = useNestedPanelState();
6365

6466
const onOpenSidebar = useCallback(
6567
(rowWhere: string) => {
@@ -73,7 +75,19 @@ export default function DBSqlRowTableWithSideBar({
7375
const onCloseSidebar = useCallback(() => {
7476
setRowId(null);
7577
setRowSource(null);
76-
}, [setRowId, setRowSource]);
78+
// When closing the main drawer, clear the nested panel state
79+
// this ensures that re-opening the main drawer will not open the nested panel
80+
if (!isNestedPanel) {
81+
setContextRowId(null);
82+
setContextRowSource(null);
83+
}
84+
}, [
85+
setRowId,
86+
setRowSource,
87+
isNestedPanel,
88+
setContextRowId,
89+
setContextRowSource,
90+
]);
7791
const renderRowDetails = useCallback(
7892
(r: { [key: string]: unknown }) => {
7993
if (!sourceData) {

0 commit comments

Comments
 (0)