diff --git a/apps/ui/src/components/layout/sidebar/hooks/use-unviewed-validations.ts b/apps/ui/src/components/layout/sidebar/hooks/use-unviewed-validations.ts index da73ad15..ac5add46 100644 --- a/apps/ui/src/components/layout/sidebar/hooks/use-unviewed-validations.ts +++ b/apps/ui/src/components/layout/sidebar/hooks/use-unviewed-validations.ts @@ -31,7 +31,10 @@ export function useUnviewedValidations(currentProject: Project | null) { const hoursSince = (Date.now() - new Date(v.validatedAt).getTime()) / (1000 * 60 * 60); return hoursSince <= 24; }); - setCount(unviewed.length); + // Only update count if we're still on the same project (guard against race condition) + if (projectPathRef.current === projectPath) { + setCount(unviewed.length); + } } } } catch (err) {