fix: avoid duplicate backlog hydration load

This commit is contained in:
Janpeter Visser 2026-05-10 07:17:28 +02:00
parent b489e26665
commit 38d99834ef
5 changed files with 47 additions and 8 deletions

View file

@ -8,9 +8,11 @@ import { debugProps } from '@/lib/debug'
// De voorganger (stores/product-store.ts) wordt in Story 8 (T-876) verwijderd.
export function SetCurrentProduct({ id, name }: { id: string; name: string }) {
useEffect(() => {
useProductWorkspaceStore.getState().setActiveProduct({ id, name })
useProductWorkspaceStore
.getState()
.setActiveProduct({ id, name }, { load: false, preserveSelection: true })
return () => {
useProductWorkspaceStore.getState().setActiveProduct(null)
useProductWorkspaceStore.getState().setActiveProduct(null, { load: false })
}
}, [id, name])