Skip to content

Commit

Permalink
Fixing bug that causes error when solution is deleted in the solution…
Browse files Browse the repository at this point in the history
… detail's page dialog.
  • Loading branch information
krulis-martin committed Jul 30, 2023
1 parent 5416190 commit 0c8f9e1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Solutions/SolutionStatus/SolutionStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const getEditNoteFormInitialValues = defaultMemoize(note => ({ note }));

const getImportantSolutions = defaultMemoize((solutions, selectedSolutionId) => {
solutions = solutions.toArray();
const selectedIdx = solutions.findIndex(s => s.id === selectedSolutionId);
const accepted = solutions.find(s => s.accepted && s.id !== selectedSolutionId) || null;
const best = solutions.find(s => s.isBestSolution && s.id !== selectedSolutionId) || null;
let lastReviewed = solutions.filter(s => s.review && s.review.closedAt).shift();
const selectedIdx = solutions.findIndex(s => s && s.id === selectedSolutionId);
const accepted = solutions.find(s => s && s.accepted && s.id !== selectedSolutionId) || null;
const best = solutions.find(s => s && s.isBestSolution && s.id !== selectedSolutionId) || null;
let lastReviewed = solutions.filter(s => s && s.review && s.review.closedAt).shift();
lastReviewed = lastReviewed && lastReviewed.id !== selectedSolutionId ? lastReviewed : null;
return { selectedIdx, accepted, best, lastReviewed };
});
Expand Down

0 comments on commit 0c8f9e1

Please sign in to comment.