Skip to content

Commit f86d3ea

Browse files
committed
AXON-762: conditionally render ErrorDisplay to avoid extra margin when no errors
1 parent a8d9245 commit f86d3ea

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/react/atlascode/startwork/v3/StartWorkPageV3.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Box, Button, CircularProgress, Typography } from '@material-ui/core';
2-
import React from 'react';
2+
import React, { useContext } from 'react';
33
import { AnalyticsView } from 'src/analyticsTypes';
44

55
import { AtlascodeErrorBoundary } from '../../common/ErrorBoundary';
6+
import { ErrorStateContext } from '../../common/errorController';
67
import { ErrorDisplay } from '../../common/ErrorDisplay';
78
import { StartWorkControllerContext, useStartWorkController } from '../startWorkController';
89
import {
@@ -16,6 +17,7 @@ import { useStartWorkFormState } from './hooks/useStartWorkFormState';
1617

1718
const StartWorkPageV3: React.FunctionComponent = () => {
1819
const [state, controller] = useStartWorkController();
20+
const errorState = useContext(ErrorStateContext);
1921

2022
const {
2123
formState,
@@ -44,9 +46,11 @@ const StartWorkPageV3: React.FunctionComponent = () => {
4446

4547
{submitState === 'submit-success' && <SuccessAlert submitResponse={submitResponse} />}
4648

47-
<Box marginBottom={2}>
48-
<ErrorDisplay />
49-
</Box>
49+
{errorState.isErrorBannerOpen && (
50+
<Box marginBottom={2}>
51+
<ErrorDisplay />
52+
</Box>
53+
)}
5054

5155
<TaskInfoSection state={state} controller={controller} />
5256
<CreateBranchSection

0 commit comments

Comments
 (0)