Skip to content
Snippets Groups Projects
Commit ae8494fa authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Prevent race conditions on round loading

parent 6254cefa
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,9 @@ class ByRoundListing extends React.Component { ...@@ -58,8 +58,9 @@ class ByRoundListing extends React.Component {
prepareOrder = () => { prepareOrder = () => {
const { isLoading, rounds, submissions } = this.props; const { isLoading, rounds, submissions } = this.props;
if (isLoading) if (isLoading || Object.entries(rounds).length === 0) {
return [] return []
}
return submissions.sort((a, b) => a.id - b.id ) return submissions.sort((a, b) => a.id - b.id )
.map(submission => submission.round) .map(submission => submission.round)
.filter((round, index, arr) => arr.indexOf(round) === index) .filter((round, index, arr) => arr.indexOf(round) === index)
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
getCurrentSubmissionID, getCurrentSubmissionID,
} from '@selectors/submissions' } from '@selectors/submissions'
import SubmissionDisplay from '@components/SubmissionDisplay'; import SubmissionDisplay from '@components/SubmissionDisplay';
import LoadingPanel from '@components/LoadingPanel'
import MessagesList from '@components/MessagesList' import MessagesList from '@components/MessagesList'
import MessageBar from '@components/MessageBar' import MessageBar from '@components/MessageBar'
...@@ -66,7 +67,7 @@ const CurrentSubmissionDisplay = props => { ...@@ -66,7 +67,7 @@ const CurrentSubmissionDisplay = props => {
} }
if ( !localSubmission ) { if ( !localSubmission ) {
return <p>Loading</p> return <LoadingPanel />
} }
const renderUpdatedMessage = () =>{ const renderUpdatedMessage = () =>{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment