diff --git a/app/src/components/model/panels/bottom/BottomPanel.js b/app/src/components/model/panels/bottom/BottomPanel.js index 3ebf6a58..8188b6d2 100644 --- a/app/src/components/model/panels/bottom/BottomPanel.js +++ b/app/src/components/model/panels/bottom/BottomPanel.js @@ -6,6 +6,7 @@ import { useState, useEffect } from "react"; import { useModelID } from "../../hooks/useModelID"; import { useSelectedComponent } from "../../hooks/useSelectedComponent"; import { useValidateQuery } from "../../../../api/gram/validation"; +import { COMPONENT_TYPE } from "../../board/constants"; export function BottomPanel() { const modelId = useModelID(); @@ -57,16 +58,15 @@ export function BottomPanel() { } useEffect(() => { - if (!selectedComponent) { + if (!selectedComponent && tab === TAB.SELECTED_COMPONENT) { setTab(0); - } else { - setTab(2); } - }, [selectedComponent]); + }, [selectedComponent, tab]); if (bottomPanelCollapsed) { return <>; } + return ( {!isLoading && ( @@ -77,12 +77,14 @@ export function BottomPanel() { allLength={allNegativeResults.length} modelLength={modelResults.length} selectedLength={selectedResults.length} + selectedComponent={selectedComponent} /> )} diff --git a/app/src/components/model/panels/bottom/BottomTabsHeader.js b/app/src/components/model/panels/bottom/BottomTabsHeader.js index aa2c61ad..7c177872 100644 --- a/app/src/components/model/panels/bottom/BottomTabsHeader.js +++ b/app/src/components/model/panels/bottom/BottomTabsHeader.js @@ -1,5 +1,4 @@ import { Paper, Grow, Tab, Tabs, Badge, Typography, Box } from "@mui/material"; -import { useSelectedComponent } from "../../hooks/useSelectedComponent"; export const TAB = { ALL: 0, @@ -32,12 +31,8 @@ export function BottomTabsHeader({ allLength, modelLength, selectedLength, + selectedComponent, }) { - const selected = useSelectedComponent(); - - // This fixes an annoying MUI console error when you deselect a component - const tabHck = !selected && tab === TAB.COMPONENT ? TAB.SYSTEM : tab; - return ( setTab(v)} textColor="inherit" variant="fullWidth" @@ -97,7 +92,7 @@ export function BottomTabsHeader({ } value={TAB.MODEL} /> - {selected && ( + {selectedComponent && (