Skip to content

Commit cf89d43

Browse files
authored
fix(protocol-designer) avoid the white screen by removing liquid (#20072)
1 parent 3e32214 commit cf89d43

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

protocol-designer/src/components/organisms/StepSummary/getLiquidDisplay.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ export function getLiquidDisplay(
1313
liquidInfo: LiquidEntity[],
1414
t: any
1515
): JSX.Element | null {
16-
const liquidLength = liquidInfo.length
16+
// filtering out liquids with no liquidEntities to prevent whitescreens
17+
// when the user deletes a liquid in use
18+
const filteredLiquids = liquidInfo.filter(
19+
liquidEntity => liquidEntity != null
20+
)
21+
const liquidLength = filteredLiquids.length
1722

1823
if (liquidLength === 0) {
1924
return null
@@ -27,8 +32,11 @@ export function getLiquidDisplay(
2732
<StyledText desktopStyle="bodyDefaultRegular">{t('of')}</StyledText>
2833
<Tag
2934
type="default"
30-
text={liquidInfo[0].displayName}
31-
liquidIcon={{ color: liquidInfo[0].displayColor, size: 'xSmall' }}
35+
text={filteredLiquids[0].displayName}
36+
liquidIcon={{
37+
color: filteredLiquids[0].displayColor,
38+
size: 'xSmall',
39+
}}
3240
/>
3341
</Flex>
3442
)
@@ -39,18 +47,18 @@ export function getLiquidDisplay(
3947
<Flex gridGap={SPACING.spacing4} alignItems={ALIGN_CENTER}>
4048
<Tag
4149
type="default"
42-
text={liquidInfo[0].displayName}
50+
text={filteredLiquids[0].displayName}
4351
liquidIcon={{
44-
color: liquidInfo[0].displayColor,
52+
color: filteredLiquids[0].displayColor,
4553
size: 'xSmall',
4654
}}
4755
/>
4856
{t('and')}
4957
<Tag
5058
type="default"
51-
text={liquidInfo[1].displayName}
59+
text={filteredLiquids[1].displayName}
5260
liquidIcon={{
53-
color: liquidInfo[1].displayColor,
61+
color: filteredLiquids[1].displayColor,
5462
size: 'xSmall',
5563
}}
5664
/>

0 commit comments

Comments
 (0)