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"> <div className="taskList__table__name-project hide-desc">
<h4>Проект:</h4> <h4>Проект:</h4>
<p> <p>
{projects.map((project) => { {projects?.map((project) => {
if (project.id == task.project_id) { if (project.id == task.project_id) {
return project.name; return project.name;
} }

View File

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

View File

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

View File

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