Skip to content

Commit d7ef6a1

Browse files
committed
fix: sonar fixes Refs: KER-571
1 parent 4c257a4 commit d7ef6a1

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/components/SocialBar/Twitter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable max-len */
22

33
const Twitter = () => {
4-
if (typeof globalThis.window === 'undefined') {
4+
if (!globalThis.window) {
55
return null;
66
}
77
return (

src/views/Home.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,20 @@ export function Home({ topHearing, openHearings, language, user, dispatch }) {
4040
const intl = useIntl();
4141
const { formatMessage } = intl;
4242
const [isMobile, setIsMobile] = useState(
43-
typeof globalThis.window !== 'undefined' && window.innerWidth < 768
43+
globalThis.window && window.innerWidth < 768
4444
);
4545

4646
const handleResize = useCallback(() => {
47-
setIsMobile(
48-
typeof globalThis.window !== 'undefined' && window.innerWidth < 768
49-
);
47+
setIsMobile(globalThis.window && window.innerWidth < 768);
5048
}, []);
5149

5250
useEffect(() => {
5351
fetchData(dispatch);
54-
if (typeof globalThis.window !== 'undefined') {
52+
if (globalThis.window) {
5553
window.addEventListener('resize', handleResize);
5654
}
5755
return () => {
58-
if (typeof globalThis.window !== 'undefined') {
56+
if (globalThis.window) {
5957
window.removeEventListener('resize', handleResize);
6058
}
6159
};

0 commit comments

Comments
 (0)