Fixed err in undef arrays

This commit is contained in:
MaxOvs19 2023-12-06 18:26:47 +03:00
parent 585604d0b9
commit f98e788201
4 changed files with 10 additions and 10 deletions

View File

@ -30,7 +30,7 @@ const AllTaskTableItem = ({ task, projects }) => {
<div className="taskList__table__name-project hide-desc">
<h4>Проект:</h4>
<p>
{projects.map((project) => {
{projects?.map((project) => {
if (project.id == task.project_id) {
return project.name;
}

View File

@ -17,8 +17,8 @@ const AllTaskTableTracker = ({ filteredAllTasks, projects, loader }) => {
useEffect(() => {
setItems(filteredAllTasks);
const endOffset = itemOffset + itemsPerPage;
setCurrentItems(filteredAllTasks.slice(itemOffset, endOffset));
setPageCount(Math.ceil(filteredAllTasks.length / itemsPerPage));
setCurrentItems(filteredAllTasks?.slice(itemOffset, endOffset));
setPageCount(Math.ceil(filteredAllTasks?.length / itemsPerPage));
}, [filteredAllTasks]);
useEffect(() => {

View File

@ -18,7 +18,7 @@ const ArchiveTableTracker = ({ filterCompleteTasks, loader }) => {
{!loader && (
<>
{Boolean(filterCompleteTasks.length) ? (
filterCompleteTasks.map((task, index) => {
filterCompleteTasks?.map((task, index) => {
return (
<ArchiveTasksItem task={task} index={index} key={index} />
);

View File

@ -187,7 +187,7 @@ export const Tracker = () => {
{projects &&
Boolean(projects.length) &&
!loader &&
projects.map((project, index) => {
projects?.map((project, index) => {
return project.status !== 10 ? (
<ProjectTiket key={index} project={project} />
) : (
@ -197,7 +197,7 @@ export const Tracker = () => {
{typeof projects === "object" &&
(!Boolean(projects.length) ||
!Boolean(
projects.filter((project) => project.status !== 10).length
projects?.filter((project) => project.status !== 10).length
)) &&
!loader && (
<div className="no-projects">
@ -380,10 +380,10 @@ export const Tracker = () => {
<h3>Архив проектов:</h3>
<p>
{`${
projects.filter((project) => project.status === 10).length
projects?.filter((project) => project.status === 10).length
}
${caseOfNum(
projects.filter((project) => project.status === 10)
projects?.filter((project) => project.status === 10)
.length,
"projects"
)}`}
@ -391,9 +391,9 @@ export const Tracker = () => {
</div>
<div className="archive__tasksWrapper">
{Boolean(
projects.filter((project) => project.status === 10).length
projects?.filter((project) => project.status === 10).length
) ? (
projects.map((project, index) => {
projects?.map((project, index) => {
return project.status === 10 ? (
<div
className="archive__completeTask-project"