[PR #27614] fix: resolve stale closure values in LLM node callbacks (#27612) #31817

Closed
opened 2026-02-21 20:50:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/27614

State: closed
Merged: Yes


What does this PR do?

Fixes #27612

Resolves data loss issue where LLM node prompt changes are lost when calling /workflows/draft API.

Changes

  • Updated 8 callback functions in use-config.ts to use inputRef.current instead of closure-captured inputs
  • Removed inputs from dependency arrays to improve performance
  • Made code consistent with other handlers in the same file and other node types

Root Cause

The callbacks were using stale closure values (inputs) instead of the latest ref value (inputRef.current), causing updates to be based on outdated data when rapid edits occurred within the 5-second debounce window.

Testing

  • Tested locally with rapid prompt edits
  • Verified /workflows/draft API receives correct data
  • No linter errors
  • No performance regressions observed
**Original Pull Request:** https://github.com/langgenius/dify/pull/27614 **State:** closed **Merged:** Yes --- ## What does this PR do? Fixes #27612 Resolves data loss issue where LLM node prompt changes are lost when calling `/workflows/draft` API. ## Changes - Updated 8 callback functions in `use-config.ts` to use `inputRef.current` instead of closure-captured `inputs` - Removed `inputs` from dependency arrays to improve performance - Made code consistent with other handlers in the same file and other node types ## Root Cause The callbacks were using stale closure values (`inputs`) instead of the latest ref value (`inputRef.current`), causing updates to be based on outdated data when rapid edits occurred within the 5-second debounce window. ## Testing - ✅ Tested locally with rapid prompt edits - ✅ Verified `/workflows/draft` API receives correct data - ✅ No linter errors - ✅ No performance regressions observed
yindo added the pull-request label 2026-02-21 20:50:12 -05:00
yindo closed this issue 2026-02-21 20:50:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31817