From 286ff8e6f1fc3ce6f54f0d794b5d770cdf8cfbeb Mon Sep 17 00:00:00 2001 From: "RIO\\teodora.misan" Date: Tue, 10 Sep 2024 18:03:04 +0300 Subject: [PATCH] EBR-91: resolve sonar issue --- src/pyunicoreWidget.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pyunicoreWidget.tsx b/src/pyunicoreWidget.tsx index f483398..7a61a62 100644 --- a/src/pyunicoreWidget.tsx +++ b/src/pyunicoreWidget.tsx @@ -318,12 +318,11 @@ export class PyunicoreComponent extends React.Component< componentWillUnmount(): void { const { updateIntervalId } = this.state; - if (typeof updateIntervalId === 'number') { - // in browser envs - clearInterval(updateIntervalId); - } else if (updateIntervalId !== undefined) { - // in Node.js envs - clearInterval(updateIntervalId); + if ( + typeof updateIntervalId === 'number' || + (typeof updateIntervalId === 'object' && updateIntervalId !== null) + ) { + clearInterval(updateIntervalId as any); } }