Skip to content

Commit 385eef7

Browse files
committed
Added no pathname condition on getIdFromPath
1 parent becd2d1 commit 385eef7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/LeftDrawerOrg/LeftDrawerOrg.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const leftDrawerOrg = ({
4343
const { getItem } = useLocalStorage();
4444
const userId = getItem('id');
4545
const getIdFromPath = (pathname: string): string => {
46+
if (!pathname) return '';
4647
const segments = pathname.split('/');
4748
// Index 2 represents the ID in paths like /member/{userId}
4849
return segments.length > 2 ? segments[2] : '';
@@ -82,7 +83,7 @@ const leftDrawerOrg = ({
8283
return () => {
8384
isMounted = false;
8485
};
85-
}, [data, location]);
86+
}, [data]);
8687

8788
/**
8889
* Handles link click to hide the drawer on smaller screens.

0 commit comments

Comments
 (0)