From f98e788201783c6fcd49e7f0240d89a39c744f51 Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Wed, 6 Dec 2023 18:26:47 +0300 Subject: [PATCH] Fixed err in undef arrays --- .../AllTaskTableItem/AllTaskTableItem.jsx | 2 +- .../AllTaskTableTracker/AllTaskTableTracker.jsx | 4 ++-- .../ArchiveTableTracker/ArchiveTableTracker.jsx | 2 +- src/pages/Tracker/Tracker.jsx | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx index dba863b0..01d98e38 100644 --- a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx +++ b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx @@ -30,7 +30,7 @@ const AllTaskTableItem = ({ task, projects }) => {

Проект:

- {projects.map((project) => { + {projects?.map((project) => { if (project.id == task.project_id) { return project.name; } diff --git a/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx index 1c4847b7..56e0575b 100644 --- a/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx +++ b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx @@ -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(() => { diff --git a/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx index f213c4c5..ac500591 100644 --- a/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx +++ b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx @@ -18,7 +18,7 @@ const ArchiveTableTracker = ({ filterCompleteTasks, loader }) => { {!loader && ( <> {Boolean(filterCompleteTasks.length) ? ( - filterCompleteTasks.map((task, index) => { + filterCompleteTasks?.map((task, index) => { return ( ); diff --git a/src/pages/Tracker/Tracker.jsx b/src/pages/Tracker/Tracker.jsx index b1ee70fa..e080b9ba 100644 --- a/src/pages/Tracker/Tracker.jsx +++ b/src/pages/Tracker/Tracker.jsx @@ -187,7 +187,7 @@ export const Tracker = () => { {projects && Boolean(projects.length) && !loader && - projects.map((project, index) => { + projects?.map((project, index) => { return project.status !== 10 ? ( ) : ( @@ -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 && (

@@ -380,10 +380,10 @@ export const Tracker = () => {

Архив проектов:

{`${ - 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 = () => {

{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 ? (