Skip to content

Commit 9c14d5a

Browse files
Merge pull request #4857 from cagdas001/fix-4758
fix(submission-management): add null checking for `currentPhase`
2 parents 9544644 + 7a3c513 commit 9c14d5a

File tree

1 file changed

+10
-6
lines changed
  • src/shared/components/SubmissionManagement/SubmissionManagement

1 file changed

+10
-6
lines changed

src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function SubmissionManagement(props) {
5252
const submissionEndDate = submissionPhase && phaseEndDate(submissionPhase);
5353

5454
const now = moment();
55-
const end = moment(currentPhase.scheduledEndDate);
55+
const end = moment(currentPhase && currentPhase.scheduledEndDate);
5656
const diff = end.isAfter(now) ? end.diff(now) : 0;
5757
const timeLeft = moment.duration(diff);
5858

@@ -81,11 +81,15 @@ export default function SubmissionManagement(props) {
8181
</a>
8282
</div>
8383
<div styleName="right-col">
84-
<p styleName="round">
85-
{currentPhase.name}
86-
</p>
8784
{
88-
challenge.status !== 'COMPLETED' ? (
85+
currentPhase && (
86+
<p styleName="round">
87+
{currentPhase.name}
88+
</p>
89+
)
90+
}
91+
{
92+
challenge.status !== 'Completed' ? (
8993
<div>
9094
<p styleName="time-left">
9195
{days > 0 && (`${days}D`)}
@@ -114,7 +118,7 @@ export default function SubmissionManagement(props) {
114118
Manage your submissions
115119
</p>
116120
{
117-
isDesign && (
121+
isDesign && currentPhase && (
118122
<p styleName="round-ends">
119123
<span styleName="ends-label">
120124
{currentPhase.name}

0 commit comments

Comments
 (0)