Skip to content

Commit 715d789

Browse files
committed
fix(poll): restores boolean mount guard for notification reset
1 parent 41215bc commit 715d789

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/app/services/poll.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,17 @@ onAuthCleared(resetPollState);
9090
// When tracked users or monitored repos change, reset notification state so the
9191
// next poll cycle silently seeds items without flooding "new item" notifications.
9292
// Tracks a serialized key (sorted logins/fullNames) so swapping entries at the
93-
// same array length still triggers the reset.
93+
// same array length still triggers the reset. Boolean mount flags ensure the
94+
// initial effect run is always skipped (key="" is a valid state for empty arrays).
95+
let _trackedUsersMounted = false;
9496
let _trackedUsersKey = "";
97+
let _monitoredReposMounted = false;
9598
let _monitoredReposKey = "";
9699
createRoot(() => {
97100
createEffect(() => {
98101
const key = (config.trackedUsers ?? []).map((u) => u.login).sort().join(",");
99-
if (_trackedUsersKey === "") {
102+
if (!_trackedUsersMounted) {
103+
_trackedUsersMounted = true;
100104
_trackedUsersKey = key;
101105
return;
102106
}
@@ -108,7 +112,8 @@ createRoot(() => {
108112

109113
createEffect(() => {
110114
const key = (config.monitoredRepos ?? []).map((r) => r.fullName).sort().join(",");
111-
if (_monitoredReposKey === "") {
115+
if (!_monitoredReposMounted) {
116+
_monitoredReposMounted = true;
112117
_monitoredReposKey = key;
113118
return;
114119
}

0 commit comments

Comments
 (0)