Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/fast-jokes-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---

various improvements to search result drawers and nesting logic
2 changes: 1 addition & 1 deletion packages/app/src/components/ContextSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface ContextSubpanelProps {
}

// Custom hook to manage nested panel state
function useNestedPanelState(isNested: boolean) {
export function useNestedPanelState(isNested?: boolean) {
// Query state (URL-based) for root level
const queryState = {
contextRowId: useQueryState('contextRowId', parseAsString),
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/DBRowSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ export default function DBRowSidePanelErrorBoundary({
<Drawer
opened={rowId != null}
withCloseButton={false}
withinPortal={!isNestedPanel}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally added in #1290 when we didn't sue mantine drawer, not needed anymore.

withOverlay={!isNestedPanel}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps prevent some issues flagged originally in #1393, ensuring clicking outside closes all modals and that there isn't multiple stacking overlays (causing outside to get darker each sub-modal)

onClose={() => {
if (!subDrawerOpen) {
_onClose();
Expand Down
16 changes: 15 additions & 1 deletion packages/app/src/components/DBSqlRowTableWithSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useSource } from '@/source';
import TabBar from '@/TabBar';
import { useLocalStorage } from '@/utils';

import { useNestedPanelState } from './ContextSidePanel';
import { RowDataPanel } from './DBRowDataPanel';
import { RowOverviewPanel } from './DBRowOverviewPanel';
import DBRowSidePanel, {
Expand Down Expand Up @@ -60,6 +61,7 @@ export default function DBSqlRowTableWithSideBar({
const { data: sourceData } = useSource({ id: sourceId });
const [rowId, setRowId] = useQueryState('rowWhere');
const [rowSource, setRowSource] = useQueryState('rowSource');
const { setContextRowId, setContextRowSource } = useNestedPanelState();

const onOpenSidebar = useCallback(
(rowWhere: string) => {
Expand All @@ -73,7 +75,19 @@ export default function DBSqlRowTableWithSideBar({
const onCloseSidebar = useCallback(() => {
setRowId(null);
setRowSource(null);
}, [setRowId, setRowSource]);
// When closing the main drawer, clear the nested panel state
// this ensures that re-opening the main drawer will not open the nested panel
if (!isNestedPanel) {
setContextRowId(null);
setContextRowSource(null);
}
}, [
setRowId,
setRowSource,
isNestedPanel,
setContextRowId,
setContextRowSource,
]);
const renderRowDetails = useCallback(
(r: { [key: string]: unknown }) => {
if (!sourceData) {
Expand Down
Loading