From 47e4bd2d3109c08ad8dc5edd77d5ec95ff36549c Mon Sep 17 00:00:00 2001 From: Clinton Lunn Date: Mon, 25 Nov 2024 11:44:57 -0700 Subject: [PATCH] refactor: use != instead of !== --- src/app/(maps)/components/FullScreenMap.tsx | 4 ++-- src/js/hooks/useUrlParams.tsx | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/(maps)/components/FullScreenMap.tsx b/src/app/(maps)/components/FullScreenMap.tsx index 8d0e59ea7..d1f3eb32d 100644 --- a/src/app/(maps)/components/FullScreenMap.tsx +++ b/src/app/(maps)/components/FullScreenMap.tsx @@ -22,12 +22,12 @@ export const FullScreenMap: React.FC = () => { const { camera, areaId: urlAreaId } = urlParams.fromUrl() - if (urlAreaId !== null) { + if (urlAreaId != null) { setAreaId(urlAreaId) } // If camera params exist in URL, use them - if (camera !== null) { + if (camera != null) { setCenter([camera.center.lng, camera.center.lat]) setZoom(camera.zoom) setIsInitialized(true) diff --git a/src/js/hooks/useUrlParams.tsx b/src/js/hooks/useUrlParams.tsx index 27425b308..15850b601 100644 --- a/src/js/hooks/useUrlParams.tsx +++ b/src/js/hooks/useUrlParams.tsx @@ -15,19 +15,19 @@ const useUrlParams = (): UseUrlParamsReturn => { const toUrl = ({ camera, areaId }: UrlProps): string => { const params = new URLSearchParams() - if (areaId !== null && areaId !== undefined) { + if (areaId != null) { params.set('areaId', areaId) } const baseUrl = `${pathname}?` - const cameraParam = (camera !== null && camera !== undefined) ? `camera=${cameraInfoToQuery(camera)}` : '' + const cameraParam = (camera != null) ? `camera=${cameraInfoToQuery(camera)}` : '' const otherParams = params.toString() - if (cameraParam !== null && otherParams !== null) { + if (cameraParam != null && otherParams != null) { return `${baseUrl}${cameraParam}&${otherParams}` - } else if (cameraParam !== null) { + } else if (cameraParam != null) { return `${baseUrl}${cameraParam}` - } else if (otherParams !== null) { + } else if (otherParams != null) { return `${baseUrl}${otherParams}` } @@ -37,7 +37,7 @@ const useUrlParams = (): UseUrlParamsReturn => { const fromUrl = (): UrlProps => { const cameraParam = searchParams.get('camera') return { - camera: cameraParam !== null ? queryToCameraInfo(cameraParam) : null, + camera: cameraParam != null ? queryToCameraInfo(cameraParam) : null, areaId: searchParams.get('areaId') } }