-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Description of the bug:
This bug was solved using Windsurf =============== When running the app, if the backend response omits or returns undefined for query_list or follow_up_queries, the frontend throws a TypeError:
TypeError: Cannot read properties of undefined (reading 'join')
at Object.onUpdateEvent (App.tsx:57:90)
This causes the UI to break and prevents further interaction.
Steps to Reproduce
Start the backend and frontend development servers as per README.
Submit a query that triggers a backend response where query_list or follow_up_queries is missing or undefined.
Observe the crash in the browser console and UI.
Actual vs expected behavior:
The frontend should handle missing or undefined fields gracefully and not crash.
Actual Behavior
The frontend crashes with a TypeError due to attempting to call .join() on undefined.
Any other information you'd like to share?
Proposed Fix
Add defensive checks in App.tsx so .join() is only called on arrays, defaulting to an empty array when the value is missing.
Patch
diff
CopyInsert
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -34,7 +34,7 @@
if (event.generate_query) {
processedEvent = {
title: "Generating Search Queries",
-
data: event.generate_query.query_list.join(", "),
-
data: (event.generate_query.query_list || []).join(", "), }; } else if (event.web_research) { const sources = event.web_research.sources_gathered || [];
@@ -53,9 +53,7 @@
title: "Reflection",
data: event.reflection.is_sufficient
? "Search successful, generating final answer."
-
: `Need more information, searching for ${event.reflection.follow_up_queries.join(
-
", "
-
)}`,
-
: `Need more information, searching for ${(event.reflection.follow_up_queries || []).join(", ")}`, }; } else if (event.finalize_answer) { processedEvent = {
Additional Notes
This fix ensures robust handling of backend responses and prevents UI crashes.
Please consider merging this patch to improve reliability for all users.