[PR #31555] refactor(workflow): persist the debug state of the chatflow preview panel to the zustand store and split useChat hook into modular files #33293

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

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

State: closed
Merged: No


Closes #31554

Summary

  • Split 535-line useChat hook into 7 focused modules
  • Add chat-preview-slice to Zustand store for centralized state
  • Fix race condition with runId protection in callbacks

Changes

File Purpose
use-chat.ts Main orchestrator
use-chat-list.ts Chat list with opening statement
use-chat-flow-control.ts Stop/restart handlers
use-chat-message-sender.ts Message sending logic
use-chat-tree-operations.ts Tree BFS mutations
use-workflow-event-handlers.ts Workflow event callbacks
chat-preview-slice.ts Zustand store slice

Test plan

  • Debug panel chat works normally
  • Stop/restart functions work
  • Suggested questions appear after response
  • Variable panel updates after run completes
**Original Pull Request:** https://github.com/langgenius/dify/pull/31555 **State:** closed **Merged:** No --- Closes #31554 ## Summary - Split 535-line `useChat` hook into 7 focused modules - Add `chat-preview-slice` to Zustand store for centralized state - Fix race condition with `runId` protection in callbacks ## Changes | File | Purpose | |------|---------| | `use-chat.ts` | Main orchestrator | | `use-chat-list.ts` | Chat list with opening statement | | `use-chat-flow-control.ts` | Stop/restart handlers | | `use-chat-message-sender.ts` | Message sending logic | | `use-chat-tree-operations.ts` | Tree BFS mutations | | `use-workflow-event-handlers.ts` | Workflow event callbacks | | `chat-preview-slice.ts` | Zustand store slice | ## Test plan - [ ] Debug panel chat works normally - [ ] Stop/restart functions work - [ ] Suggested questions appear after response - [ ] Variable panel updates after run completes
yindo added the pull-request label 2026-02-21 20:53:01 -05:00
yindo closed this issue 2026-02-21 20:53:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33293