Skip to content

Commit

Permalink
Improve renderSolution function if solution is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Oct 9, 2023
1 parent b1964af commit 8fc04f4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions assets/js/components/SaptuneDetails/SaptuneDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ const renderNotes = (notes) => {
return notes.map((noteID, index) => [index > 0 && ', ', renderNote(noteID)]);
};

const renderSolution = ({ id, notes, partial }) => (
<span>
{id} ({renderNotes(notes)}
{partial ? '-> Partial' : ''})
</span>
);
const renderSolution = (solution) => {
if (!solution) {
return <span>-</span>;
}

const { id, notes, partial } = solution;

return (
<span>
{id} ({renderNotes(notes)}
{partial ? '-> Partial' : ''})
</span>
);
};

function SaptuneDetails({
appliedNotes,
Expand Down

0 comments on commit 8fc04f4

Please sign in to comment.