From b08892744eb0c7017806b2ed6bbab749432b7047 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 18 Apr 2025 22:46:04 -0600 Subject: [PATCH] query checks --- .../BusterChartJS/core/plugins/chartjs-plugin-crosshair.tsx | 5 ++++- web/src/components/ui/inputs/InputTextArea.tsx | 2 +- web/src/context/Chats/useChatStreamMessage.ts | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/components/ui/charts/BusterChartJS/core/plugins/chartjs-plugin-crosshair.tsx b/web/src/components/ui/charts/BusterChartJS/core/plugins/chartjs-plugin-crosshair.tsx index 1c0791692..7e0210070 100644 --- a/web/src/components/ui/charts/BusterChartJS/core/plugins/chartjs-plugin-crosshair.tsx +++ b/web/src/components/ui/charts/BusterChartJS/core/plugins/chartjs-plugin-crosshair.tsx @@ -34,11 +34,13 @@ const crosshairPlugin: Plugin<'line'> = { // Initialize the crosshair state beforeInit(chart: Chart) { + if (!chart) return; chart.$crosshair = { x: null, y: null }; }, // Capture mouse events to update the crosshair coordinates afterEvent(chart: Chart, args: { event: ChartEvent }) { + if (!chart) return; const event = args.event; if (event.type === 'mousemove') { chart.$crosshair = chart.$crosshair || { x: null, y: null }; @@ -54,12 +56,13 @@ const crosshairPlugin: Plugin<'line'> = { // Draw the crosshair lines and labels after the chart is rendered afterDraw(chart: Chart, args, options: CrosshairPluginOptions) { + if (!chart) return; const { ctx, chartArea: { top, bottom, left, right } } = chart; const crosshair = chart.$crosshair; - if (!crosshair) return; + if (!crosshair || !ctx) return; const { x, y } = crosshair; // Only draw if the pointer is within the chart area diff --git a/web/src/components/ui/inputs/InputTextArea.tsx b/web/src/components/ui/inputs/InputTextArea.tsx index 249a42137..a96bf2899 100644 --- a/web/src/components/ui/inputs/InputTextArea.tsx +++ b/web/src/components/ui/inputs/InputTextArea.tsx @@ -95,7 +95,7 @@ export const InputTextArea = React.forwardRef { const textarea = textareaRef.current; - if (!textarea || !autoResize || textarea.value === '') return; + if (!textarea || !autoResize) return; const minHeight = calculateMinHeight(); if (!minHeight) return; diff --git a/web/src/context/Chats/useChatStreamMessage.ts b/web/src/context/Chats/useChatStreamMessage.ts index 8489c171e..01df145d7 100644 --- a/web/src/context/Chats/useChatStreamMessage.ts +++ b/web/src/context/Chats/useChatStreamMessage.ts @@ -88,6 +88,9 @@ export const useChatStreamMessage = () => { onUpdateChat(iChat); removeBlackBoxMessage({ messageId: iChat.message_ids[iChat.message_ids.length - 1] }); prefetchLastMessageMetricData(iChat, iChatMessages); + queryClient.invalidateQueries({ + queryKey: [queryKeys.chatsGetList().queryKey, queryKeys.metricsGetList().queryKey] + }); }); const stopChatCallback = useMemoizedFn((chatId: string) => {