diff options
| author | Eric Guo <[email protected]> | 2026-01-23 15:23:06 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-23 15:23:06 +0800 |
| commit | b29898226821ec16455b67321200056090a7320c (patch) | |
| tree | 7c27c37b018ac285a9dd48b6e579f9d5611d72da | |
| parent | 47a2b9e8dfe8f1d1d1a46c88a981edf55dd916b7 (diff) | |
| download | opencode-b29898226821ec16455b67321200056090a7320c.tar.gz opencode-b29898226821ec16455b67321200056090a7320c.zip | |
fix(desktop): Fixed a reactive feedback loop in the global project cache sync (#10139)
| -rw-r--r-- | packages/app/src/context/global-sync.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx index 5f0f3d76f..cfbaa3723 100644 --- a/packages/app/src/context/global-sync.tsx +++ b/packages/app/src/context/global-sync.tsx @@ -28,6 +28,7 @@ import { batch, createContext, createEffect, + untrack, getOwner, runWithOwner, useContext, @@ -174,8 +175,12 @@ function createGlobalSync() { createEffect(() => { if (!projectCacheReady()) return - if (globalStore.project.length === 0 && projectCache.value.length !== 0) return - setProjectCache("value", globalStore.project.map(sanitizeProject)) + const projects = globalStore.project + if (projects.length === 0) { + const cachedLength = untrack(() => projectCache.value.length) + if (cachedLength !== 0) return + } + setProjectCache("value", projects.map(sanitizeProject)) }) createEffect(async () => { |
