From 1b893a416271a8be7a13bc79895d64973022f1f4 Mon Sep 17 00:00:00 2001 From: Zubeen Date: Sun, 8 Oct 2023 02:42:45 +0530 Subject: [PATCH 1/5] refactor: add an operational chain instead of expressions check (#803) --- library/src/containers/Servers/Security.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/src/containers/Servers/Security.tsx b/library/src/containers/Servers/Security.tsx index 2575c286b..b02b3219b 100644 --- a/library/src/containers/Servers/Security.tsx +++ b/library/src/containers/Servers/Security.tsx @@ -26,8 +26,7 @@ export const Security: React.FunctionComponent = ({ let renderedSecurities; if ( - !security || - !security.length || + !security?.length || !securitySchemes || !Object.keys(securitySchemes).length ) { From 828b42ade2c4223ff01bce38c91fa09cc3685166 Mon Sep 17 00:00:00 2001 From: Zubeen Date: Sun, 8 Oct 2023 03:24:19 +0530 Subject: [PATCH 2/5] refactor: remove redudant return statement (#802) Co-authored-by: Lukasz Gornicki --- library/src/containers/AsyncApi/Standalone.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/library/src/containers/AsyncApi/Standalone.tsx b/library/src/containers/AsyncApi/Standalone.tsx index c92027275..4f5d72fb6 100644 --- a/library/src/containers/AsyncApi/Standalone.tsx +++ b/library/src/containers/AsyncApi/Standalone.tsx @@ -32,7 +32,6 @@ class AsyncApiComponent extends Component { if (parsedSpec) { this.state = { asyncapi: parsedSpec }; } - return; } async componentDidMount() { From eed3f36ed39016a9843fdafe5ab02efdd81e427e Mon Sep 17 00:00:00 2001 From: Paras Date: Sun, 8 Oct 2023 03:33:47 +0530 Subject: [PATCH 3/5] refactor: add optional chain expression (#811) Co-authored-by: Lukasz Gornicki --- library/src/containers/Servers/Security.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/containers/Servers/Security.tsx b/library/src/containers/Servers/Security.tsx index b02b3219b..21569a7d7 100644 --- a/library/src/containers/Servers/Security.tsx +++ b/library/src/containers/Servers/Security.tsx @@ -275,7 +275,7 @@ const SecurityItem: React.FunctionComponent = ({ )} - {securitySchema && securitySchema.hasDescription() && ( + {securitySchema?.hasDescription() && (
{securitySchema.description()}
From 229aa2f4bf952d2cf28f25a243e16e8f35234450 Mon Sep 17 00:00:00 2001 From: Paras Date: Sun, 8 Oct 2023 03:43:13 +0530 Subject: [PATCH 4/5] refactor: add optional chain expressions (#812) Co-authored-by: Lukasz Gornicki --- library/src/helpers/message.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/helpers/message.ts b/library/src/helpers/message.ts index 398700a80..82356dde9 100644 --- a/library/src/helpers/message.ts +++ b/library/src/helpers/message.ts @@ -53,7 +53,7 @@ export class MessageHelpers { } const payload = msg.payload(); - if (payload && payload.examples()) { + if (payload?.examples()) { return payload.examples()?.map(example => ({ example })); } @@ -84,7 +84,7 @@ export class MessageHelpers { } const headers = msg.headers(); - if (headers && headers.examples()) { + if (headers?.examples()) { return headers.examples()?.map(example => ({ example })); } From c54659d11095581fd13b5e7c4ced7d00207b40eb Mon Sep 17 00:00:00 2001 From: Paras Date: Mon, 9 Oct 2023 15:28:37 +0530 Subject: [PATCH 5/5] refactor: remove the redundant-jump code (#807) --- library/src/helpers/message.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/library/src/helpers/message.ts b/library/src/helpers/message.ts index 82356dde9..5c7158853 100644 --- a/library/src/helpers/message.ts +++ b/library/src/helpers/message.ts @@ -56,7 +56,6 @@ export class MessageHelpers { if (payload?.examples()) { return payload.examples()?.map(example => ({ example })); } - return; } @@ -87,7 +86,6 @@ export class MessageHelpers { if (headers?.examples()) { return headers.examples()?.map(example => ({ example })); } - - return; + return undefined; } }