[PR #25003] fix: prevent workflow canvas clearing due to race condition and viewport errors #30884

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

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

State: closed
Merged: Yes


Changes

Fixed race condition issues that caused workflow canvas to clear after publishing and refreshing:

Modified Files:

  1. use-nodes-sync-draft.ts: Added initialization state detection to prevent syncing empty workflow data
  2. use-workflow-interactions.ts: Added viewport validation to prevent undefined property access errors
  3. use-workflow-refresh-draft.ts: Ensured complete data structure with default viewport values

Problem Solved:

  • Prevents canvas clearing after publish + refresh
  • Fixes 'Cannot read properties of undefined (reading x)' viewport errors
  • Reduces 400 HTTP errors from invalid sync requests

All changes are backward compatible with defensive programming approach.

**Original Pull Request:** https://github.com/langgenius/dify/pull/25003 **State:** closed **Merged:** Yes --- ## Changes Fixed race condition issues that caused workflow canvas to clear after publishing and refreshing: ### Modified Files: 1. **use-nodes-sync-draft.ts**: Added initialization state detection to prevent syncing empty workflow data 2. **use-workflow-interactions.ts**: Added viewport validation to prevent undefined property access errors 3. **use-workflow-refresh-draft.ts**: Ensured complete data structure with default viewport values ### Problem Solved: - Prevents canvas clearing after publish + refresh - Fixes 'Cannot read properties of undefined (reading x)' viewport errors - Reduces 400 HTTP errors from invalid sync requests All changes are backward compatible with defensive programming approach.
yindo added the pull-request label 2026-02-21 20:48:25 -05:00
yindo closed this issue 2026-02-21 20:48:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30884