perf(explorer-sidebar): skip PR queries when sidebar is closed

Thread isOpen down to SidebarContent so usePrPaneData stays disabled
until the user actually opens the sidebar.
This commit is contained in:
Mohamed Boudra
2026-04-20 10:45:51 +07:00
parent bd748b6edc
commit 044546ae0c
@@ -292,6 +292,7 @@ export function ExplorerSidebar({
workspaceRoot={workspaceRoot} workspaceRoot={workspaceRoot}
isGit={isGit} isGit={isGit}
isMobile={isMobile} isMobile={isMobile}
isOpen={isOpen}
onOpenFile={onOpenFile} onOpenFile={onOpenFile}
/> />
</Animated.View> </Animated.View>
@@ -324,6 +325,7 @@ export function ExplorerSidebar({
workspaceRoot={workspaceRoot} workspaceRoot={workspaceRoot}
isGit={isGit} isGit={isGit}
isMobile={false} isMobile={false}
isOpen={isOpen}
onOpenFile={onOpenFile} onOpenFile={onOpenFile}
/> />
</View> </View>
@@ -340,6 +342,7 @@ interface SidebarContentProps {
workspaceRoot: string; workspaceRoot: string;
isGit: boolean; isGit: boolean;
isMobile: boolean; isMobile: boolean;
isOpen: boolean;
onOpenFile?: (filePath: string) => void; onOpenFile?: (filePath: string) => void;
} }
@@ -352,6 +355,7 @@ function SidebarContent({
workspaceRoot, workspaceRoot,
isGit, isGit,
isMobile, isMobile,
isOpen,
onOpenFile, onOpenFile,
}: SidebarContentProps) { }: SidebarContentProps) {
const { theme } = useUnistyles(); const { theme } = useUnistyles();
@@ -360,8 +364,8 @@ function SidebarContent({
const prPane = usePrPaneData({ const prPane = usePrPaneData({
serverId, serverId,
cwd: workspaceRoot, cwd: workspaceRoot,
enabled: canQueryPullRequest, enabled: canQueryPullRequest && isOpen,
timelineEnabled: activeTab === "pr" && canQueryPullRequest, timelineEnabled: activeTab === "pr" && canQueryPullRequest && isOpen,
}); });
const hasPullRequest = prPane.prNumber !== null; const hasPullRequest = prPane.prNumber !== null;
const requestedTab: ExplorerTab = const requestedTab: ExplorerTab =