Skip to content

Commit 0510ba8

Browse files
committed
feat: pass initialCollection state when navigating from CommandPalette
1 parent 0ccefaa commit 0510ba8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

frontend/components/CommandPalette.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const CommandPalette: React.FC<CommandPaletteProps> = ({
256256
),
257257
action: () => {
258258
onCollectionSelect?.(col.name);
259-
if (explorerHref) navigate(explorerHref);
259+
if (explorerHref) navigate(explorerHref, { state: { initialCollection: col.name } });
260260
},
261261
});
262262
});

frontend/pages/DataExplorerPageWrapper.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface LocationState {
1010
accountName?: string;
1111
availableDbs?: DbInfo[];
1212
availableAccounts?: CosmosDBAccount[];
13+
initialCollection?: string;
1314
}
1415

1516
const DataExplorerPageWrapper: React.FC = () => {
@@ -24,7 +25,9 @@ const DataExplorerPageWrapper: React.FC = () => {
2425

2526
const [loading, setLoading] = useState(true);
2627
const [error, setError] = useState<string | null>(null);
27-
const [activeCollection, setActiveCollection] = useState<string | undefined>(undefined);
28+
const [activeCollection, setActiveCollection] = useState<string | undefined>(
29+
(location.state as LocationState)?.initialCollection
30+
);
2831

2932
// Used to keep sidebar populated during the async load so there's no visual flash
3033
const [sessionCache] = useState<{ accountName?: string; collections?: CollectionSummary[]; availableAccounts?: CosmosDBAccount[]; availableDbs?: DbInfo[] } | null>(() => {

0 commit comments

Comments
 (0)