fix(desktop): Fixed a reactive feedback loop in the global project cache sync (#10139)
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
|||||||
batch,
|
batch,
|
||||||
createContext,
|
createContext,
|
||||||
createEffect,
|
createEffect,
|
||||||
|
untrack,
|
||||||
getOwner,
|
getOwner,
|
||||||
runWithOwner,
|
runWithOwner,
|
||||||
useContext,
|
useContext,
|
||||||
@@ -174,8 +175,12 @@ function createGlobalSync() {
|
|||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (!projectCacheReady()) return
|
if (!projectCacheReady()) return
|
||||||
if (globalStore.project.length === 0 && projectCache.value.length !== 0) return
|
const projects = globalStore.project
|
||||||
setProjectCache("value", globalStore.project.map(sanitizeProject))
|
if (projects.length === 0) {
|
||||||
|
const cachedLength = untrack(() => projectCache.value.length)
|
||||||
|
if (cachedLength !== 0) return
|
||||||
|
}
|
||||||
|
setProjectCache("value", projects.map(sanitizeProject))
|
||||||
})
|
})
|
||||||
|
|
||||||
createEffect(async () => {
|
createEffect(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user