feature/IO-3291-Tasks-Notifications: Checkpoint
This commit is contained in:
@@ -32,7 +32,11 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskU
|
||||
}, [bodyshop, currentUser]);
|
||||
|
||||
// Query 1: Tasks with due dates
|
||||
const { data: dueDateData, loading: dueLoading } = useQuery(QUERY_TASKS_WITH_DUE_DATES, {
|
||||
const {
|
||||
data: dueDateData,
|
||||
loading: dueLoading,
|
||||
error: dueError
|
||||
} = useQuery(QUERY_TASKS_WITH_DUE_DATES, {
|
||||
variables: {
|
||||
bodyshop: bodyshop?.id,
|
||||
assigned_to: assignedToId,
|
||||
@@ -47,6 +51,7 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskU
|
||||
const {
|
||||
data: noDueDateData,
|
||||
loading: noDueLoading,
|
||||
error: noDueError,
|
||||
fetchMore
|
||||
} = useQuery(QUERY_TASKS_NO_DUE_DATE_PAGINATED, {
|
||||
variables: {
|
||||
@@ -68,6 +73,10 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskU
|
||||
setTasks([...dueDateTasks, ...noDueDateTasks]);
|
||||
}, [dueDateData, noDueDateData]);
|
||||
|
||||
const noDueDateLength = noDueDateData?.tasks?.length || 0;
|
||||
const totalNoDueDate = noDueDateData?.tasks_aggregate?.aggregate?.count || 0;
|
||||
const hasMore = noDueDateLength < totalNoDueDate;
|
||||
|
||||
// Handle pagination for no-due-date tasks
|
||||
const handleLoadMore = () => {
|
||||
fetchMore({
|
||||
@@ -109,9 +118,10 @@ const TaskCenterContainer = ({ visible, onClose, bodyshop, currentUser, setTaskU
|
||||
onClose={onClose}
|
||||
tasks={tasks}
|
||||
loading={dueLoading || noDueLoading}
|
||||
error={dueError || noDueError}
|
||||
onTaskClick={handleTaskClick}
|
||||
onLoadMore={handleLoadMore}
|
||||
totalTasks={noDueDateData?.tasks_aggregate?.aggregate?.count || 0}
|
||||
hasMore={hasMore}
|
||||
createNewTask={createNewTask}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user