feat: implement real-time list synchronization
- Add useRealtimeSync hook for polling server updates every 3 seconds - Create API endpoint to check last updated timestamp for lists - Integrate real-time sync into ListDetailView component - Automatically refresh when other users make changes to shared lists - Poll on interval and when page becomes visible again
This commit is contained in:
@@ -11,6 +11,7 @@ import ShareListModal from './ShareListModal'
|
||||
import PermissionBadge from './PermissionBadge'
|
||||
import { searchItems, getItemsByFilter } from '@/lib/actions'
|
||||
import { useSearch, useFilters, useScrollPosition } from '@/hooks'
|
||||
import { useRealtimeSync } from '@/hooks/useRealtimeSync'
|
||||
|
||||
interface Item {
|
||||
id: string
|
||||
@@ -73,6 +74,13 @@ export default function ListDetailView({
|
||||
// Use scroll position preservation hook
|
||||
useScrollPosition({ key: `list-${listId}` })
|
||||
|
||||
// Use real-time sync hook to poll for updates
|
||||
useRealtimeSync({
|
||||
listId,
|
||||
enabled: true,
|
||||
pollInterval: 3000, // Poll every 3 seconds
|
||||
})
|
||||
|
||||
// Extract all unique tags from items
|
||||
const availableTags = useMemo(() => {
|
||||
const tagSet = new Set<string>()
|
||||
|
||||
Reference in New Issue
Block a user