Skip to content

feat(app): add manual refresh for the session file tree - #48154

Closed
Jweokk wants to merge 1 commit into
anomalyco:devfrom
Jweokk:feat/file-tree-refresh
Closed

Jweokk wants to merge 1 commit into
anomalyco:devfrom
Jweokk:feat/file-tree-refresh

Conversation

@Jweokk

@Jweokk Jweokk commented Sep 9, 2026 •

Copy link
Copy Markdown

Issue for this PR

Related to #38125 and #27333 — when files change outside the app (or a watcher event is missed), the session file tree stays stale until a full page reload. There is no open issue for this exact button; #30661 asked for one but was auto-closed. Happy to move this under a new issue if you prefer.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The tree only updates from file.watcher.updated events, and invalidateFromWatcher() in packages/app/src/context/file/watcher.ts only refreshes the parent directory of the changed path — and only when that directory is already loaded. So when I copy/edit/add files from outside the app, the sidebar keeps showing the old state until I reload the page.

This adds a small manual escape hatch: a refresh button in the file browser sidebar header that force-reloads every directory currently listed. The tree store already tracks which dirs were listed and dedupes in-flight requests, so refreshAll() just force-lists those again (never-loaded dirs are skipped, so nothing expands unexpectedly).

Concretely: refreshAll() on the tree store + file.tree.refreshAll(), an icon button in the sidebar header (existing outline-reset icon; the header gets an optional actions slot, existing callers unaffected), a session.files.refresh string in all locales, and unit tests for the store.

How did you verify your code works?

  • New unit tests in packages/app/src/context/file/tree-store.test.ts (cached dirs not re-fetched on normal ops, force reload picks up new entries, never-loaded dirs are skipped)
  • bun run test:unit in packages/app: 728 pass, 0 fail
  • bun run typecheck passes for @opencode-ai/app, @opencode-ai/session-ui, @opencode-ai/ui

Screenshots / recordings

I'll add a short recording of the sidebar header with the new button.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

invalidateFromWatcher() only refreshes the parent directory of a
changed path and only when it is already loaded, so external changes
can leave the tree stale until a full page reload.

Add file.tree.refreshAll() (force-reload every listed directory) and
a refresh button in the sidebar header.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title app: add manual refresh for the session file tree doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 9, 2026
@Jweokk Jweokk changed the title app: add manual refresh for the session file tree feat(app): add manual refresh for the session file tree Sep 9, 2026
@github-actions github-actions Bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant