Fix ListDetailView not updating when items change
- Add useEffect to sync filteredItems state with initialItems prop - Now when router.refresh() updates initialItems, the UI updates - Deleted items now disappear immediately after refresh
This commit is contained in:
@@ -143,6 +143,11 @@ export default function ListDetailView({
|
||||
onFiltersChange: handleFiltersCallback
|
||||
})
|
||||
|
||||
// Update filtered items when initialItems changes (after refresh)
|
||||
useEffect(() => {
|
||||
setFilteredItems(initialItems)
|
||||
}, [initialItems])
|
||||
|
||||
// Apply initial filters on mount
|
||||
useEffect(() => {
|
||||
handleFiltersCallback(filters)
|
||||
|
||||
Reference in New Issue
Block a user