diff --git a/src/main/WorkflowSelection.tsx b/src/main/WorkflowSelection.tsx index e8d0ad96c..8a64d1487 100644 --- a/src/main/WorkflowSelection.tsx +++ b/src/main/WorkflowSelection.tsx @@ -31,7 +31,12 @@ const WorkflowSelection : React.FC = () => { const dispatch = useDispatch(); // Initialite redux states - const workflows = useSelector(selectWorkflows) + let workflows = useSelector(selectWorkflows) + // Need to make copy to handle undefined displayOrder values + workflows = [...workflows].sort((a, b) => { + return (b.displayOrder - a.displayOrder) + }) + const finishState = useSelector(selectFinishState) const pageNumber = useSelector(selectPageNumber) const theme = useTheme() diff --git a/src/redux/videoSlice.ts b/src/redux/videoSlice.ts index 55c4959af..c9c230fb0 100644 --- a/src/redux/videoSlice.ts +++ b/src/redux/videoSlice.ts @@ -245,9 +245,7 @@ const videoSlice = createSlice({ state.duration = action.payload.duration state.title = action.payload.title state.segments = parseSegments(action.payload.segments, action.payload.duration) - state.workflows = action.payload.workflows.sort((n1: { displayOrder: number; }, n2: { displayOrder: number; }) => { - return n1.displayOrder - n2.displayOrder; - }); + state.workflows = action.payload.workflows state.waveformImages = action.payload.waveformURIs ? action.payload.waveformURIs : state.waveformImages state.originalThumbnails = state.tracks.map((track: Track) => { return {id: track.id, uri: track.thumbnailUri} })