From fe5bb888ab8a25f0e9b5daa042c69ceb75381df2 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Mon, 4 Nov 2024 14:01:04 -0500 Subject: [PATCH] KPMP-5673: set default accordion to LM if it exists --- src/actions/Participants/participantActions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/actions/Participants/participantActions.js b/src/actions/Participants/participantActions.js index 89a7b29..0a7f94e 100644 --- a/src/actions/Participants/participantActions.js +++ b/src/actions/Participants/participantActions.js @@ -48,7 +48,8 @@ export const getParticipantSlides = (participantId, props) => { for (let key of keys) { sortedData[key] = newData[key] } - dispatch(setSelectedParticipant({id: participantId, slides: sortedData, selectedSlide:sortedData["(LM) Light Microscopy"][0], selectedAccordion: "(LM) Light Microscopy"})); + let defaultSlideType = ("(LM) Light Microscopy" in sortedData) ? "(LM) Light Microscopy" : keys[0] + dispatch(setSelectedParticipant({id: participantId, slides: sortedData, selectedSlide:sortedData[defaultSlideType][0], selectedAccordion: defaultSlideType})); props.history.push(process.env.PUBLIC_URL + "/slides"); }) .catch(err => {