From 871f393e01e9e1f9d201318f5009eebd859fa133 Mon Sep 17 00:00:00 2001 From: monoid Date: Sat, 13 Apr 2024 01:31:46 +0900 Subject: [PATCH] small fix --- .../src/components/gallery/GalleryCard.tsx | 5 +++- .../client/src/components/layout/layout.tsx | 2 +- packages/client/src/components/layout/nav.tsx | 2 +- packages/client/src/hook/fetcher.ts | 8 ++++-- packages/client/src/hook/useSearchGallery.ts | 26 ++++++++++++------ packages/client/src/page/galleryPage.tsx | 8 +++--- packages/client/src/page/settingPage.tsx | 1 - packages/client/src/state/user.ts | 8 +++--- packages/server/src/db/doc.ts | 27 +++++++++++-------- 9 files changed, 54 insertions(+), 33 deletions(-) diff --git a/packages/client/src/components/gallery/GalleryCard.tsx b/packages/client/src/components/gallery/GalleryCard.tsx index a0b02fd..9381f02 100644 --- a/packages/client/src/components/gallery/GalleryCard.tsx +++ b/packages/client/src/components/gallery/GalleryCard.tsx @@ -4,6 +4,7 @@ import TagBadge from "@/components/gallery/TagBadge.tsx"; import { Fragment, useLayoutEffect, useRef, useState } from "react"; import { LazyImage } from "./LazyImage.tsx"; import StyledLink from "./StyledLink.tsx"; +import React from "react"; function clipTagsWhenOverflow(tags: string[], limit: number) { let l = 0; @@ -17,7 +18,7 @@ function clipTagsWhenOverflow(tags: string[], limit: number) { return tags; } -export function GalleryCard({ +function GalleryCardImpl({ doc: x }: { doc: Document; }) { const ref = useRef(null); @@ -85,3 +86,5 @@ export function GalleryCard({ ; } + +export const GalleryCard = React.memo(GalleryCardImpl); \ No newline at end of file diff --git a/packages/client/src/components/layout/layout.tsx b/packages/client/src/components/layout/layout.tsx index c4380d6..1216fc8 100644 --- a/packages/client/src/components/layout/layout.tsx +++ b/packages/client/src/components/layout/layout.tsx @@ -40,7 +40,7 @@ export default function Layout({ children }: LayoutProps) { - + {children} diff --git a/packages/client/src/components/layout/nav.tsx b/packages/client/src/components/layout/nav.tsx index 10ee170..51fa2dd 100644 --- a/packages/client/src/components/layout/nav.tsx +++ b/packages/client/src/components/layout/nav.tsx @@ -32,7 +32,7 @@ export function NavItem({ export function NavList() { const loginInfo = useLogin(); - return