summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/pages
diff options
context:
space:
mode:
authoradamelmore <[email protected]>2026-01-27 16:13:00 -0600
committeradamelmore <[email protected]>2026-01-27 16:13:11 -0600
commitd17ba84ee1e55093ff33f0ac512cbb00030c21e7 (patch)
treefa0fb5a12748e44a4cb9f7b5854036db60e2d4c4 /packages/app/src/pages
parent5c8580a187d437f2813a9cc315ab04db5acf7ad1 (diff)
downloadopencode-d17ba84ee1e55093ff33f0ac512cbb00030c21e7.tar.gz
opencode-d17ba84ee1e55093ff33f0ac512cbb00030c21e7.zip
fix(app): file tree not always loading
Diffstat (limited to 'packages/app/src/pages')
-rw-r--r--packages/app/src/pages/session.tsx34
1 files changed, 9 insertions, 25 deletions
diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx
index a4e6e24b1..eda15a581 100644
--- a/packages/app/src/pages/session.tsx
+++ b/packages/app/src/pages/session.tsx
@@ -1255,34 +1255,18 @@ export default function Page() {
const wants = isDesktop() ? fileTreeTab() === "changes" : store.mobileTab === "changes"
if (!wants) return
if (sync.data.session_diff[id] !== undefined) return
+ if (sync.status === "loading") return
- const state = {
- cancelled: false,
- attempt: 0,
- timer: undefined as number | undefined,
- }
-
- const load = () => {
- if (state.cancelled) return
- const pending = sync.session.diff(id)
- if (!pending) return
- pending.catch(() => {
- if (state.cancelled) return
- const attempt = state.attempt + 1
- state.attempt = attempt
- if (attempt > 5) return
- if (state.timer !== undefined) clearTimeout(state.timer)
- const wait = Math.min(10000, 250 * 2 ** (attempt - 1))
- state.timer = window.setTimeout(load, wait)
- })
- }
+ void sync.session.diff(id)
+ })
- load()
+ createEffect(() => {
+ if (!isDesktop()) return
+ if (!layout.fileTree.opened()) return
+ if (sync.status === "loading") return
- onCleanup(() => {
- state.cancelled = true
- if (state.timer !== undefined) clearTimeout(state.timer)
- })
+ fileTreeTab()
+ void file.tree.list("")
})
const autoScroll = createAutoScroll({