From 8713caaa178ec5dd7d548b8c5dc3a5dfc4e12321 Mon Sep 17 00:00:00 2001 From: Nick Diehl <47604184+ncdiehl11@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:01:51 -0400 Subject: [PATCH] fix(app): fix labware location on labware details modal (ODD protocol details) (#16198) On ODD Protocol Details > Deck tab, we render the protocol deck with clickable labware. Clicking a labware or stack should render the appropriate modal, whose header should be the location of that labware or stack. However, similar to how we handle this in Protocol Setup, we need to find the __initial__ locaiton of the labware at load time, rather than the final location of the labware. Here, I access that initial location to properly display the slot location icon for labware that is moved. Closes [RQA-3149](https://opentrons.atlassian.net/browse/RQA-3149) --- app/src/pages/ProtocolDetails/Deck.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/pages/ProtocolDetails/Deck.tsx b/app/src/pages/ProtocolDetails/Deck.tsx index d9c95508264..5960bcf6564 100644 --- a/app/src/pages/ProtocolDetails/Deck.tsx +++ b/app/src/pages/ProtocolDetails/Deck.tsx @@ -52,16 +52,23 @@ export const Deck = (props: { protocolId: string }): JSX.Element => { labware => labware.id === labwareId ) if (foundLabware != null) { + const location = onDeckItems.find( + item => item.labwareId === foundLabware.id + )?.initialLocation const nickName = onDeckItems.find( item => getLabwareDefURI(item.definition) === foundLabware.definitionUri )?.nickName - setSelectedLabware({ - ...labwareDef, - location: foundLabware.location, - nickName: nickName ?? null, - id: labwareId, - }) - setShowLabwareDetailsModal(true) + if (location != null) { + setSelectedLabware({ + ...labwareDef, + location: location, + nickName: nickName ?? null, + id: labwareId, + }) + setShowLabwareDetailsModal(true) + } else { + console.warn('no initial labware location found') + } } }