Skip to content

Commit 5503702

Browse files
committed
fix(submission-management): add null checking for currentPhase
1 parent 3c91974 commit 5503702

File tree

1 file changed

+9
-5
lines changed
  • src/shared/components/SubmissionManagement/SubmissionManagement

1 file changed

+9
-5
lines changed

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default function SubmissionManagement(props) {
4949
.sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
5050

5151
const now = moment();
52-
const end = moment(currentPhase.scheduledEndDate);
52+
const end = moment(currentPhase && currentPhase.scheduledEndDate);
5353
const diff = end.isAfter(now) ? end.diff(now) : 0;
5454
const timeLeft = moment.duration(diff);
5555

@@ -78,9 +78,13 @@ export default function SubmissionManagement(props) {
7878
</a>
7979
</div>
8080
<div styleName="right-col">
81-
<p styleName="round">
82-
{currentPhase.name}
83-
</p>
81+
{
82+
currentPhase && (
83+
<p styleName="round">
84+
{currentPhase.name}
85+
</p>
86+
)
87+
}
8488
{
8589
challenge.status !== 'COMPLETED' ? (
8690
<div>
@@ -111,7 +115,7 @@ export default function SubmissionManagement(props) {
111115
Manage your submissions
112116
</p>
113117
{
114-
isDesign && (
118+
isDesign && currentPhase && (
115119
<p styleName="round-ends">
116120
<span styleName="ends-label">
117121
{currentPhase.name}

0 commit comments

Comments
 (0)