Yuki Takei 1 год назад
Родитель
Сommit
98b609319d
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      packages/ui/src/components/UserPicture.tsx

+ 4 - 4
packages/ui/src/components/UserPicture.tsx

@@ -15,7 +15,7 @@ const DEFAULT_IMAGE = '/images/icons/user.svg';
 
 
 
 
 type UserPictureRootProps = {
 type UserPictureRootProps = {
-  user: Partial<IUser>,
+  user: IUser,
   className?: string,
   className?: string,
   children?: ReactNode,
   children?: ReactNode,
 }
 }
@@ -28,11 +28,11 @@ const UserPictureRootWithLink = forwardRef<HTMLSpanElement, UserPictureRootProps
   const router = useRouter();
   const router = useRouter();
 
 
   const { user } = props;
   const { user } = props;
-  const href = pagePathUtils.userHomepagePath(user);
 
 
   const clickHandler = useCallback(() => {
   const clickHandler = useCallback(() => {
+    const href = pagePathUtils.userHomepagePath(user);
     router.push(href);
     router.push(href);
-  }, [href, router]);
+  }, [router, user]);
 
 
   // Using <span> tag here instead of <a> tag because UserPicture is used in SearchResultList which is essentially a anchor tag.
   // Using <span> tag here instead of <a> tag because UserPicture is used in SearchResultList which is essentially a anchor tag.
   // Nested anchor tags causes a warning.
   // Nested anchor tags causes a warning.
@@ -64,7 +64,7 @@ const withTooltip = (UserPictureSpanElm: React.ForwardRefExoticComponent<UserPic
 /**
 /**
  * type guard to determine whether the specified object is IUser
  * type guard to determine whether the specified object is IUser
  */
  */
-const isUserObj = (obj: Partial<IUser> | Ref<IUser>): obj is Partial<IUser> => {
+const isUserObj = (obj: Partial<IUser> | Ref<IUser>): obj is IUser => {
   return typeof obj !== 'string' && 'username' in obj;
   return typeof obj !== 'string' && 'username' in obj;
 };
 };