File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ import { useCallback } from 'react';
66
77export type TaskItemEntityType = 'vendor' | 'risk' ;
88
9+ // Default polling interval for cross-user updates (5 seconds)
10+ const DEFAULT_TASK_ITEMS_POLLING_INTERVAL = 5000 ;
11+
912export type TaskItemStatus = 'todo' | 'in_progress' | 'in_review' | 'done' | 'canceled' ;
1013
1114export type TaskItemPriority = 'urgent' | 'high' | 'medium' | 'low' ;
@@ -211,6 +214,9 @@ export function useTaskItems(
211214
212215 return useApiSWR < PaginatedTaskItemsResponse > ( endpoint , {
213216 ...options ,
217+ // Cross-user updates: when another teammate edits tasks, this view should update without refresh
218+ refreshInterval : options . refreshInterval ?? DEFAULT_TASK_ITEMS_POLLING_INTERVAL ,
219+ revalidateOnFocus : options . revalidateOnFocus ?? true ,
214220 // Keep previous data visible while loading new page
215221 keepPreviousData : true ,
216222 } ) ;
@@ -229,7 +235,11 @@ export function useTaskItemsStats(
229235 ? `/v1/task-management/stats?entityId=${ entityId } &entityType=${ entityType } `
230236 : null ;
231237
232- return useApiSWR < TaskItemsStats > ( endpoint , options ) ;
238+ return useApiSWR < TaskItemsStats > ( endpoint , {
239+ ...options ,
240+ refreshInterval : options . refreshInterval ?? DEFAULT_TASK_ITEMS_POLLING_INTERVAL ,
241+ revalidateOnFocus : options . revalidateOnFocus ?? true ,
242+ } ) ;
233243}
234244
235245/**
You can’t perform that action at this time.
0 commit comments