diff --git a/app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx b/app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx index 0295d5fd..bd818c21 100644 --- a/app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx +++ b/app/frontend/src/components/AnalysisPanel/AnalysisPanel.tsx @@ -32,6 +32,8 @@ const pivotItemDisabledStyle: React.CSSProperties = { }; export const AnalysisPanel = ({ answer, activeTab, activeCitation, sourceFile, pageNumber, citationHeight, className, onActiveTabChanged }: Props) => { + + const [innerPivotTab, setInnerPivotTab] = useState('indexedFile'); const [activeCitationObj, setActiveCitationObj] = useState(); const [markdownContent, setMarkdownContent] = useState(''); const [plainTextContent, setPlainTextContent] = useState(''); @@ -99,6 +101,9 @@ export const AnalysisPanel = ({ answer, activeTab, activeCitation, sourceFile, p } useEffect(() => { + if (activeCitation) { + setInnerPivotTab('indexedFile'); + } fetchActiveCitationObj(); }, [activeCitation]); @@ -175,7 +180,14 @@ export const AnalysisPanel = ({ answer, activeTab, activeCitation, sourceFile, p onRenderItemLink = {onRenderItemLink("No active citation selected. Please select a citation from the citations list on the left.", tooltipRef3, isDisabledCitationTab)} > - + { + if (item) { + setInnerPivotTab(item.props.itemKey!); + } else { + // Handle the case where item is undefined + console.warn('Item is undefined'); + } + }}> {activeCitationObj === undefined ? ( Loading...