feat(PBI-74): migreer backlog-componenten naar workspace-store (Story 3)
Story 3 verplaatst alle UI-consumers van de oude vier stores
(useBacklogStore/usePlannerStore/useSelectionStore/useProductStore) naar de
nieuwe product-workspace-store. De oude stores blijven nog bestaan voor
hydration-wrapper en realtime-hook (dual-dispatch); Story 8 ruimt ze op.
- T-848 backlog-split-pane.tsx: leest activePbiId/activeStoryId uit
context-slice (primitives, geen useShallow nodig).
- T-849 pbi-list.tsx: selectVisiblePbis(useShallow); DnD via
applyOptimisticMutation('pbi-order' + optionele 'entity-patch' bij
cross-priority drag), met settle/rollback per server-result.
- T-850 story-panel.tsx: selectStoriesForActivePbi(useShallow); DnD via
applyOptimisticMutation('story-order' + entity-patch bij priority change).
- T-851 task-panel.tsx: selectTasksForActiveStory(useShallow); DnD via
applyOptimisticMutation('task-order'); detail-view (ensureTaskLoaded +
isDetail) zit in de task-dialog (apart component, niet in deze lijst).
- T-852 start-sprint-button.tsx: selectActivePbi + selectStoriesForActivePbi
voor free-story count.
- T-853 set-current-product.tsx: alleen workspace-store.setActiveProduct
(oude useProductStore-import verwijderd).
- T-854 G1/G2-audit: alle nieuwe selectors gebruiken module-level EMPTY
refs (G1) en useShallow voor lijsten (G2). Geen 'Maximum update depth'-
warnings tijdens npm test.
- T-855 tests bijgewerkt: backlog-split-pane.test, task-panel.test,
integration.test gebruiken nu setState op workspace-store (helpers
resetWorkspace/setActiveStoryAndTasks/selectPbi/selectStory).
Verify: lint+typecheck clean, 636/636 tests groen. UI-consumers van
oude stores zijn nu nul (uitgezonderd dual-dispatch in hydration-wrapper en
realtime-hook + dev-fingerprint-helper, die in Story 8/T-873/T-878 verdwijnen).
Refs: PBI-74, ST-1320, T-848..T-855
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a98e60fcc7
commit
5aec101c83
9 changed files with 256 additions and 158 deletions
|
|
@ -1,26 +1,18 @@
|
|||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
import { useProductStore } from '@/stores/product-store'
|
||||
import { useProductWorkspaceStore } from '@/stores/product-workspace/store'
|
||||
import { debugProps } from '@/lib/debug'
|
||||
|
||||
// PBI-74 / T-847: zet zowel oude useProductStore.setCurrentProduct als de
|
||||
// nieuwe workspace-store.setActiveProduct. setActiveProduct triggert
|
||||
// ensureProductLoaded met een requestId-guard; de fetch-stub levert tijdens
|
||||
// Story 2 nog geen echte data — echte LIST-endpoints komen in Story 7
|
||||
// (T-870). Restore-hint flow volgt in Story 4 (T-857).
|
||||
// PBI-74 / T-853: workspace-store is nu enige bron voor active product.
|
||||
// De voorganger (stores/product-store.ts) wordt in Story 8 (T-876) verwijderd.
|
||||
export function SetCurrentProduct({ id, name }: { id: string; name: string }) {
|
||||
const { setCurrentProduct, clearCurrentProduct } = useProductStore()
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentProduct(id, name)
|
||||
useProductWorkspaceStore.getState().setActiveProduct({ id, name })
|
||||
return () => {
|
||||
clearCurrentProduct()
|
||||
useProductWorkspaceStore.getState().setActiveProduct(null)
|
||||
}
|
||||
}, [id, name, setCurrentProduct, clearCurrentProduct])
|
||||
}, [id, name])
|
||||
|
||||
return <span {...debugProps('set-current-product')} hidden />
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue