Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

fix: Xgen Node#260

Merged
CocoRoF merged 2 commits intodeployfrom
main
Oct 21, 2025
Merged

fix: Xgen Node#260
CocoRoF merged 2 commits intodeployfrom
main

Conversation

@CocoRoF
Copy link
Collaborator

@CocoRoF CocoRoF commented Oct 21, 2025

This pull request improves the stability and performance of the AgentXgenNode component by refining how output ports are updated in response to changes in the streaming parameter. The main focus is on preventing unnecessary re-renders and ensuring the latest callback reference is used, which enhances compatibility in production environments.

Performance and Stability Improvements:

  • Introduced a useRef (onOutputsUpdateRef) to always use the latest onOutputsUpdate callback, preventing stale closures and ensuring correct behavior when the callback changes. [1] [2]
  • Optimized the dependency for output port recalculation: now only the streamingValue is used as a dependency in useMemo, reducing unnecessary recomputation and re-renders.
  • Updated the useEffect for output updates to depend only on streamingValue and related variables, and to use the latest callback from onOutputsUpdateRef. Output updates are now only triggered when the actual output ID changes, preventing redundant updates.

Documentation Updates:

  • Enhanced the component’s documentation to explain the use of useRef for callback reference stability and the rationale for the new dependency structure, clarifying production compatibility considerations.

@CocoRoF CocoRoF merged commit 7652535 into deploy Oct 21, 2025
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant