[PR #1459] [MERGED] fix: handle subgraph custom events in stream processing #1475

Closed
opened 2026-02-15 20:15:54 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1459
Author: @MauritsBrinkman
Created: 7/29/2025
Status: Merged
Merged: 7/29/2025
Merged by: @dqbd

Base: mainHead: main


📝 Commits (3)

  • aa8cf74 fix: handle subgraph custom events in stream processing
  • 89ae9d2 Code review
  • 853fb51 Add changeset

📊 Changes

2 files changed (+13 additions, -2 deletions)

View changed files

.changeset/true-ties-sin.md (+5 -0)
📝 libs/sdk/src/react/stream.tsx (+8 -2)

📄 Description

Fix: Handle Subgraph Custom Events in Stream Processing

Problem

When streamSubgraphs: true is enabled, subgraph custom events (custom|subgraph_id|node_id) are not processed because the stream only checks for exact event === "custom" matches.

Solution

Updated event processing to handle both standard custom events and subgraph custom events by checking for events that start with "custom|".

Changes

  • Modified event condition: event === "custom" || event.startsWith("custom|")
  • Updated EventStreamEvent type to include subgraph variants
  • Fixed null/undefined handling in stream processing functions

Testing

  • TypeScript compilation passes
  • Maintains backward compatibility
  • Follows existing pattern for subgraph message events

This ensures UI components from subgraphs are properly rendered when streaming is enabled. Greetings from Captide!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/1459 **Author:** [@MauritsBrinkman](https://github.com/MauritsBrinkman) **Created:** 7/29/2025 **Status:** ✅ Merged **Merged:** 7/29/2025 **Merged by:** [@dqbd](https://github.com/dqbd) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`aa8cf74`](https://github.com/langchain-ai/langgraphjs/commit/aa8cf7459739d4641593cb692df0475bc151164a) fix: handle subgraph custom events in stream processing - [`89ae9d2`](https://github.com/langchain-ai/langgraphjs/commit/89ae9d2ef33d6c9212a216017f24d92aec145e18) Code review - [`853fb51`](https://github.com/langchain-ai/langgraphjs/commit/853fb51f15f163da190aa1492fed6d23e83cfbfc) Add changeset ### 📊 Changes **2 files changed** (+13 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/true-ties-sin.md` (+5 -0) 📝 `libs/sdk/src/react/stream.tsx` (+8 -2) </details> ### 📄 Description # Fix: Handle Subgraph Custom Events in Stream Processing ## Problem When `streamSubgraphs: true` is enabled, subgraph custom events (`custom|subgraph_id|node_id`) are not processed because the stream only checks for exact `event === "custom"` matches. ## Solution Updated event processing to handle both standard custom events and subgraph custom events by checking for events that start with "custom|". ## Changes - Modified event condition: `event === "custom" || event.startsWith("custom|")` - Updated `EventStreamEvent` type to include subgraph variants - Fixed null/undefined handling in stream processing functions ## Testing - TypeScript compilation passes - Maintains backward compatibility - Follows existing pattern for subgraph message events This ensures UI components from subgraphs are properly rendered when streaming is enabled. Greetings from [Captide](https://www.captide.ai)! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 20:15:54 -05:00
yindo closed this issue 2026-02-15 20:15:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1475