Skip to content

Commit

Permalink
add changeWatch variable to TaskList, works within a tab #124
Browse files Browse the repository at this point in the history
  • Loading branch information
blahosyl committed Aug 14, 2024
1 parent 00f32cd commit 199b3a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/pages/tasks/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const Task = (props) => {
taskDetail,
taskList,
setTasks,
setChangedWatch,
} = props;

const currentUser = useCurrentUser();
Expand Down Expand Up @@ -109,6 +110,7 @@ const Task = (props) => {
: task;
}),
}));
setChangedWatch(true);
} catch (err) {
console.log(err);
}
Expand All @@ -129,6 +131,7 @@ const Task = (props) => {
: task;
}),
}));
setChangedWatch(true);
} catch (err) {
console.log(err);
}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/tasks/TaskList.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function TaskList({ message, filter = "" , taskList}) {

const [hasLoaded, setHasLoaded] = useState(false);

const [changedWatch, setChangedWatch] = useState(false);

const { pathname } = useLocation();

const [query, setQuery] = useState("");
Expand All @@ -48,7 +50,7 @@ function TaskList({ message, filter = "" , taskList}) {
return () => {
clearTimeout(timer);
};
}, [filter, query, pathname, currentUser]);
}, [filter, query, pathname, currentUser, changedWatch]);

return (
<Row className="h-100 mt-3">
Expand All @@ -75,6 +77,8 @@ function TaskList({ message, filter = "" , taskList}) {
key={task.id} {...task}
setTasks={setTasks}
taskList={taskList}
changedWatch={changedWatch}
setChangedWatch={setChangedWatch}
/>
))}
dataLength={tasks.results.length}
Expand Down

0 comments on commit 199b3a4

Please sign in to comment.