From 0b2e58aab4556b4f4d5843e5ca98497cb7678aff Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:38:03 +0000 Subject: [PATCH 1/3] fix(graph-section): expand result prop type to support StreamableValue Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- components/graph-section.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/graph-section.tsx b/components/graph-section.tsx index 1148bdb1..9f2e4765 100644 --- a/components/graph-section.tsx +++ b/components/graph-section.tsx @@ -29,7 +29,7 @@ import { StreamableValue, useStreamableValue } from 'ai/rsc' const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884d8', '#82ca9d'] interface GraphSectionProps { - result: DataAnalysisResult | string | StreamableValue + result: DataAnalysisResult | string | StreamableValue | StreamableValue } export function GraphSection({ result }: GraphSectionProps) { From e6ec2b3d256b531536205fbe6eddf774686e1421 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:47:09 +0000 Subject: [PATCH 2/3] fix: resolve build errors and random page refreshes 1. Fix type error in `app/actions.tsx`: Expanded `GraphSectionProps` to support `StreamableValue` for hydrated tool outputs. 2. Fix random refreshes in `components/chat.tsx`: Implemented `lastRefreshedMessageIdRef` to ensure `router.refresh()` is called exactly once per unique AI response, preventing infinite loops and unintended reloads. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- chat_diff.patch | 27 +++++++++++++++++++++++++++ components/chat.tsx | 11 +++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 chat_diff.patch diff --git a/chat_diff.patch b/chat_diff.patch new file mode 100644 index 00000000..3546db5e --- /dev/null +++ b/chat_diff.patch @@ -0,0 +1,27 @@ +--- components/chat.tsx ++++ components/chat.tsx +@@ -40,6 +40,7 @@ + const [isSubmitting, setIsSubmitting] = useState(false) + const [suggestions, setSuggestions] = useState(null) + const chatPanelRef = useRef(null); ++ const lastRefreshedMessageIdRef = useRef(null) + + const handleAttachment = () => { + chatPanelRef.current?.handleAttachmentClick(); +@@ -76,10 +77,15 @@ + }, [id, path, messages]) + + useEffect(() => { +- if (aiState.messages[aiState.messages.length - 1]?.type === 'response') { +- // Refresh the page to chat history updates ++ // Find the last message of type 'response' ++ const responseMessage = [...aiState.messages] ++ .reverse() ++ .find(m => m.type === 'response') ++ ++ if (responseMessage && responseMessage.id !== lastRefreshedMessageIdRef.current) { ++ // Refresh the page to update chat history in the sidebar ++ lastRefreshedMessageIdRef.current = responseMessage.id + router.refresh() + } + }, [aiState, router]) diff --git a/components/chat.tsx b/components/chat.tsx index ef47a124..809acaab 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -40,6 +40,7 @@ export function Chat({ id }: ChatProps) { const [isSubmitting, setIsSubmitting] = useState(false) const [suggestions, setSuggestions] = useState(null) const chatPanelRef = useRef(null); + const lastRefreshedMessageIdRef = useRef(null) const handleAttachment = () => { chatPanelRef.current?.handleAttachmentClick(); @@ -76,8 +77,14 @@ export function Chat({ id }: ChatProps) { }, [id, path, messages]) useEffect(() => { - if (aiState.messages[aiState.messages.length - 1]?.type === 'response') { - // Refresh the page to chat history updates + // Find the last message of type 'response' + const responseMessage = [...aiState.messages] + .reverse() + .find(m => m.type === 'response') + + if (responseMessage && responseMessage.id !== lastRefreshedMessageIdRef.current) { + // Refresh the page to update chat history in the sidebar + lastRefreshedMessageIdRef.current = responseMessage.id router.refresh() } }, [aiState, router]) From d9a2d8fa4b54cec0f6e948f6080a323f936ec959 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:57:40 +0000 Subject: [PATCH 3/3] fix: resolve build errors and unintended page/map refreshes 1. Fix type error in `app/actions.tsx`: Expanded `GraphSectionProps` to support `StreamableValue` for hydrated tool outputs. 2. Fix infinite/random refreshes in `components/chat.tsx`: - Implemented `lastRefreshedMessageIdRef` to ensure `router.refresh()` is called exactly once per AI response. - Removed nested `MapDataProvider` shadowing, which was resetting map state on every `Chat` re-render. 3. Fix map re-initialization in `components/map/mapbox-map.tsx`: Adjusted `useEffect` dependencies to prevent destroying and recreating the Mapbox instance during camera movements. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- components/chat.tsx | 8 ++++---- components/map/mapbox-map.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/chat.tsx b/components/chat.tsx index 809acaab..15b8b3df 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -113,7 +113,7 @@ export function Chat({ id }: ChatProps) { // Mobile layout if (isMobile) { return ( - {/* Add Provider */} + <>
@@ -167,13 +167,13 @@ export function Chat({ id }: ChatProps) { )}
-
+ ); } // Desktop layout return ( - {/* Add Provider */} + <>
{/* This is the new div for scrolling */} @@ -231,6 +231,6 @@ export function Chat({ id }: ChatProps) { {activeView ? : isUsageOpen ? : }
-
+ ); } diff --git a/components/map/mapbox-map.tsx b/components/map/mapbox-map.tsx index ef876721..eecd7f54 100644 --- a/components/map/mapbox-map.tsx +++ b/components/map/mapbox-map.tsx @@ -467,7 +467,7 @@ export const Mapbox: React.FC<{ position?: { latitude: number; longitude: number geolocationWatchIdRef.current = null } } - }, [setMap, setIsMapLoaded, captureMapCenter, handleUserInteraction, stopRotation, position?.latitude, position?.longitude, mapData.cameraState]) + }, [setMap, setIsMapLoaded, captureMapCenter, handleUserInteraction, stopRotation]) // Handle map mode changes useEffect(() => {