Skip to content

Commit

Permalink
fixes sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethaasan committed Feb 29, 2024
1 parent a9db82b commit 2151d45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions playground/components/CodeEditorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class CodeEditorComponent extends Component<Props, State> {

componentDidUpdate(nextProps: Props) {
const { externalResource } = this.props;
if (nextProps.externalResource !== externalResource) {
this.setState({ code: externalResource! });
if (externalResource && nextProps.externalResource !== externalResource) {
this.setState({ code: externalResource });
}
}

Expand Down
6 changes: 4 additions & 2 deletions playground/components/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { TabLink, TabWrapper } from './styled';

export interface TabProps {
children: React.ReactNode;
children: React.ReactNode; // NOSONAR
title: string;
tabIndex?: number;
isActive?: boolean;
Expand All @@ -19,7 +19,9 @@ class Tab extends Component<TabProps> {
<TabLink
onClick={(event: any) => {
event.preventDefault();
parentCallback!(tabIndex!);
if (parentCallback && tabIndex) {
parentCallback(tabIndex);
}
}}
active={isActive}
>
Expand Down

0 comments on commit 2151d45

Please sign in to comment.