Skip to content

Commit ccd5548

Browse files
authored
Merge pull request #11348 from gitbutlerapp/prevent-infinite-head-loop
Avoid infinite loop by tracking previous head
2 parents 10878b8 + 85ebf42 commit ccd5548

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/desktop/src/routes/[projectId]/+layout.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,14 @@
206206
const head = $derived(headResponse.response);
207207
208208
// If the head changes, invalidate stacks and details
209+
// We need to track the previous head value to avoid infinite loops
210+
let previousHead = $state<string | undefined>(undefined);
209211
$effect(() => {
210-
if (head) {
211-
stackService.invalidateStacksAndDetails();
212+
if (head && head !== previousHead) {
213+
untrack(() => {
214+
previousHead = head;
215+
stackService.invalidateStacksAndDetails();
216+
});
212217
}
213218
});
214219

0 commit comments

Comments
 (0)