Skip to content

fix(dashboard): auto-refresh file tree after file-modifying tool operations#1579

Closed
Bernardxu123 wants to merge 2 commits into
esengine:mainfrom
Bernardxu123:fix/file-tree-refresh
Closed

fix(dashboard): auto-refresh file tree after file-modifying tool operations#1579
Bernardxu123 wants to merge 2 commits into
esengine:mainfrom
Bernardxu123:fix/file-tree-refresh

Conversation

@Bernardxu123

Copy link
Copy Markdown
Collaborator

Summary

When file-modifying tools (delete_file, write_file, edit_file, etc.) complete in the TUI, the dashboard's file tree panel now automatically refreshes to reflect the current filesystem state.

Fixes #1564


Problem

The dashboard's file tree was fetched once on component mount and never refreshed. After the AI agent used file-modifying tools:

  • Deleted files still appeared in the tree
  • New files were not visible
  • Manual refresh was not available (Ctrl+R was verbose toggle, F5 was unmapped)
  • Users reported black screens when trying to refresh

Solution

1. Refresh Function in useProjectTree()

Added a
efresh() function to the useProjectTree() hook that re-fetches the file tree from the server.

2. Manual Refresh Button

Added a refresh button (↻) in the file tree header for manual refresh.

3. Auto-Refresh on Tool Completion

The dashboard's SSE connection now listens for ool events. When a file-modifying tool completes, the file tree automatically refreshes after a 300ms delay.

Supported tools:

  • delete_file, delete_directory
  • write_file, edit_file, multi_edit
  • create_directory, move_file, copy_file

Files Changed

File Change
dashboard/src/lib/file-tree.ts Added refresh() function and refreshKey state
dashboard/src/panels/changes.ts Added refresh button, onToolComplete prop to ChatPane, auto-refresh logic
dashboard/src/i18n/en.ts Added refreshTree translation key
dashboard/src/i18n/zh-CN.ts Added Chinese translation for refresh button

Testing

  • npm run lint
  • npm run typecheck

CI Fix added 2 commits May 23, 2026 09:53
…ations (esengine#1564)

When tools like delete_file, write_file, edit_file etc. complete, the
dashboard's file tree panel now automatically refreshes to reflect the
current filesystem state.

Changes:
- Add refresh() function to useProjectTree() hook
- Add manual refresh button (↻) in file tree header
- Listen to SSE tool.end events and auto-refresh when file-modifying
  tools complete (delete_file, write_file, edit_file, etc.)
- Pass onToolComplete callback from ChangesPanel to ChatPane

Fixes esengine#1564
…witch (esengine#1217)

When a session switch happens while a turn is running, the old turn's
cleanup code may still emit events (, , etc.)
that arrive after the new session is active, causing UI lag and state
corruption.

Add a switching flag to the Tab interface:
- Set tab.switching = true before aborting in session_load/new_chat
- In runTurn's finally block, check tab.switching to suppress stale events
- Reset tab.switching = false after processing

This prevents the old turn from emitting events that would interfere
with the new session's state.

Fixes esengine#1217
@esengine

Copy link
Copy Markdown
Owner

Thanks for the work, but this one I need to close — there are a few separate problems and one of them is structural.

1. The dashboard portion targets files that no longer exist (blocker)

The PR base is cf148a12 (#1570), but 462b79b1 (#1418, "port desktop dashboard from Tauri+Preact to CLI-hosted React Web app") landed after that and deleted both dashboard/src/lib/file-tree.ts and dashboard/src/panels/changes.ts. GitHub already shows mergeable: CONFLICTING / mergeStateStatus: DIRTY. CI is green because it ran against your branch's stale base, not against current main.

More fundamentally: the current React dashboard under dashboard/src/ doesn't surface a project file tree at all — grep for useProjectTree / FileTree / project-tree in dashboard/src/ returns only two leftover i18n keys with no implementation. The bug #1564 reports is about a Preact panel that the dashboard rewrite removed entirely. The right place to handle #1564 now is the issue itself — whether the new dashboard should expose a file tree at all is a design discussion that needs to happen before any implementation PR. That's not something to fold into a refresh-button PR.

2. Two unrelated fixes in one PR

git log on this branch shows two commits:

The PR title and description only mention the first. The second touches src/cli/commands/desktop.ts with a tab.switching flag and addresses a completely different issue (#1217, Mac desktop session-switch lag). Different file, different motivation, different blast radius. Project rule is one logical change per PR — bundling these means a reviewer who isn't sold on the dashboard work can't accept the desktop work either.

3. The desktop.ts change on its own looks salvageable

The switching flag pattern is reasonable: set it before abortTurn, check it in runTurn's finally to skip $turn_complete / $plan_cleared / emitSessions / emitBalance from the aborted turn, then clear it. The flag's lifetime is bounded by the existing async promise — no race with the next turn's start, because the next turn won't run until the current promise settles. The path on main (src/cli/commands/desktop.ts:1387-1403) is essentially unchanged from what you edited, so this should rebase cleanly.

Please pull that commit out into a standalone PR against current main, linked to #1217. I expect that one to land.

4. Commit author identity

Both commits are authored by CI Fix <fix@ci.local> — that looks like a placeholder identity, possibly from a CI environment. When the PR is squash-merged, that name ends up in the Co-authored-by trailer in main's history. Please configure git with your real name / email before pushing the desktop.ts PR (git config user.name / git config user.email in the cloned repo).

Summary of what to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

删除文件后右侧文件管理器显示残留,手动刷新导致 Reasonix 黑屏

2 participants