Skip to content

Commit

Permalink
refactor(botonic-react): avoid cheking tow times if Cover exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Nov 18, 2024
1 parent 4ff34fe commit 118bff0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/botonic-react/src/webchat/cover-component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ export const CoverComponent = ({ component, componentProps }: Props) => {
toggleCoverComponent(false)

Check warning on line 23 in packages/botonic-react/src/webchat/cover-component/index.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/webchat/cover-component/index.tsx#L22-L23

Added lines #L22 - L23 were not covered by tests
}

if (!Cover) {
if (!Cover || !webchatState.isCoverComponentOpen) {
return null

Check warning on line 27 in packages/botonic-react/src/webchat/cover-component/index.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/webchat/cover-component/index.tsx#L27

Added line #L27 was not covered by tests
}

return Cover && webchatState.isCoverComponentOpen ? (
<Cover closeComponent={closeCoverComponent} {...coverComponentProps} />
) : null
return <Cover closeComponent={closeCoverComponent} {...coverComponentProps} />

Check warning on line 30 in packages/botonic-react/src/webchat/cover-component/index.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/webchat/cover-component/index.tsx#L30

Added line #L30 was not covered by tests
}

0 comments on commit 118bff0

Please sign in to comment.