From 6b04299b8422e5ca0928b27da96a679dd4ffa2e5 Mon Sep 17 00:00:00 2001 From: Naman Kumar Date: Thu, 24 Oct 2024 15:54:43 +0200 Subject: [PATCH] WIP --- .../chat/cells/contextCell/ContextCell.tsx | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/vscode/webviews/chat/cells/contextCell/ContextCell.tsx b/vscode/webviews/chat/cells/contextCell/ContextCell.tsx index 49a64a88411..76771de2c94 100644 --- a/vscode/webviews/chat/cells/contextCell/ContextCell.tsx +++ b/vscode/webviews/chat/cells/contextCell/ContextCell.tsx @@ -109,19 +109,15 @@ export const ContextCell: FunctionComponent<{ }) }, [excludedContext.length, usedContext.length]) - const triggerAccordion = useCallback(() => { + const onEditContext = useCallback(() => { setAccordionValue(prev => { if (!prev) { recordContextCellOpening() } return prev ? '' : 'item-1' }) - }, [recordContextCellOpening]) - - const onEditContext = useCallback(() => { - triggerAccordion() onManuallyEditContext() - }, [triggerAccordion, onManuallyEditContext]) + }, [onManuallyEditContext, recordContextCellOpening]) const { config: { internalDebugContext }, @@ -129,15 +125,19 @@ export const ContextCell: FunctionComponent<{ const telemetryRecorder = useTelemetryRecorder() const oneboxEnabled = useExperimentalOneBox() - const logValueChange = useCallback( + const handleValueChange = useCallback( (value: string | undefined) => { + setAccordionValue(value) + if (value) { + recordContextCellOpening() + } if (oneboxEnabled) { telemetryRecorder.recordEvent('onebox.contextDrawer', 'clicked', { [value ? 'expanded' : 'collapsed']: 1, }) } }, - [telemetryRecorder, oneboxEnabled] + [telemetryRecorder, oneboxEnabled, recordContextCellOpening] ) const [showAllResults, setShowAllResults] = useState(false) @@ -148,10 +148,7 @@ export const ContextCell: FunctionComponent<{ @@ -159,8 +156,6 @@ export const ContextCell: FunctionComponent<{