Skip to content

Commit

Permalink
one more rerender bug (#1370)
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->



> [!IMPORTANT]
> Optimize `TabularView` re-renders by using `useMemo` for `testAtom`.
> 
>   - **Performance**:
> - Use `useMemo` for `testAtom` in `TabularView` to optimize re-renders
when `selectedItem` changes.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 4870967. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
aaronvg authored Jan 22, 2025
1 parent 55ba52d commit 997585f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ParsedResponseRenderer } from './ParsedResponseRender'
import { TestStatus } from './TestStatus'
import { ScrollArea } from '~/components/ui/scroll-area'
import { vscode } from '@/shared/baml-project-panel/vscode'
import { useMemo } from 'react'
interface TabularViewProps {
currentRun: TestHistoryRun
}
Expand Down Expand Up @@ -123,9 +124,11 @@ export const TabularView: React.FC<TabularViewProps> = ({ currentRun }) => {
}))
}

const tc = useAtomValue(
testcaseObjectAtom({ functionName: selectedItem?.[0] ?? '', testcaseName: selectedItem?.[1] ?? '' }),
const testAtom = useMemo(
() => testcaseObjectAtom({ functionName: selectedItem?.[0] ?? '', testcaseName: selectedItem?.[1] ?? '' }),
[selectedItem],
)
const tc = useAtomValue(testAtom)

const createSpan = (span: { start: number; end: number; file_path: string; start_line: number }) => ({
start: span.start,
Expand Down

0 comments on commit 997585f

Please sign in to comment.