A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Fix panel selection when hiding items from sidebar/developer panel (#7754)
Trevor Manz77343ae6f1f7
diff --git a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsxindex 3486c2c970..23852b762f 100644--- a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx+++ b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx@@ -193,6 +193,29 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {});}, [isDeveloperPanelOpen]);+ // Auto-correct developer panel selection when the selected tab is no longer available+ useEffect(() => {+ if (!isDeveloperPanelOpen) {+ return;+ }+ const isSelectionValid = devPanelItems.some(+ (p) => p.type === selectedDeveloperPanelTab,+ );+ if (!isSelectionValid) {+ if (devPanelItems.length > 0) {+ openApplication(devPanelItems[0].type);+ } else {+ setIsDeveloperPanelOpen(false);+ }+ }+ }, [+ isDeveloperPanelOpen,+ devPanelItems,+ selectedDeveloperPanelTab,+ openApplication,+ setIsDeveloperPanelOpen,+ ]);+const appBodyPanel = (<Panel id="app" key="app" className="relative h-full"><Suspense>{children}</Suspense>diff --git a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx b/frontend/src/components/editor/chrome/wrapper/sidebar.tsxindex f10c76d907..c8dde2d089 100644--- a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx+++ b/frontend/src/components/editor/chrome/wrapper/sidebar.tsx@@ -4,7 +4,7 @@ import { useAtom, useAtomValue } from "jotai";import { MessageCircleQuestionIcon } from "lucide-react";import type React from "react";import type { PropsWithChildren } from "react";-import { useMemo } from "react";+import { useEffect, useMemo } from "react";import { ReorderableList } from "@/components/ui/reorderable-list";import { Tooltip } from "@/components/ui/tooltip";import {@@ -23,8 +23,10 @@ import {} from "../types";export const Sidebar: React.FC = () => {- const { selectedPanel, selectedDeveloperPanelTab } = useChromeState();- const { toggleApplication, openApplication } = useChromeActions();+ const { selectedPanel, selectedDeveloperPanelTab, isSidebarOpen } =+ useChromeState();+ const { toggleApplication, openApplication, setIsSidebarOpen } =+ useChromeActions();const [panelLayout, setPanelLayout] = useAtom(panelLayoutAtom);// Subscribe to capabilities to re-render when they changeconst capabilities = useAtomValue(capabilitiesAtom);@@ -91,6 +93,27 @@ export const Sidebar: React.FC = () => {toggleApplication(item.type);};+ // Auto-correct sidebar selection when the selected panel is no longer available+ useEffect(() => {+ if (!isSidebarOpen) {+ return;+ }+ const isSelectionValid = sidebarItems.some((p) => p.type === selectedPanel);+ if (!isSelectionValid) {+ if (sidebarItems.length > 0) {+ openApplication(sidebarItems[0].type);+ } else {+ setIsSidebarOpen(false);+ }+ }+ }, [+ isSidebarOpen,+ sidebarItems,+ selectedPanel,+ openApplication,+ setIsSidebarOpen,+ ]);+return (<div className="h-full pt-4 pb-1 px-1 flex flex-col items-start text-muted-foreground text-md select-none no-print text-sm z-50 dark:bg-background print:hidden hide-on-fullscreen"><ReorderableList<PanelDescriptor>