Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

feat(web): memoize composer modules (#5836)

authored by yoginth.com and committed by

GitHub 65620a8d 709b98a5

+8 -7
+2 -2
apps/web/src/components/Composer/Actions/Attachment.tsx
··· 11 11 } from "@lens-protocol/metadata"; 12 12 import { useClickAway } from "@uidotdev/usehooks"; 13 13 import type { ChangeEvent, JSX, MutableRefObject } from "react"; 14 - import { useId, useState } from "react"; 14 + import { memo, useId, useState } from "react"; 15 15 import { toast } from "sonner"; 16 16 import MenuTransition from "@/components/Shared/MenuTransition"; 17 17 import { Spinner, Tooltip } from "@/components/Shared/UI"; ··· 155 155 ); 156 156 }; 157 157 158 - export default Attachment; 158 + export default memo(Attachment);
+2 -2
apps/web/src/components/Composer/ChooseThumbnail.tsx
··· 1 1 import { CheckCircleIcon, PhotoIcon } from "@heroicons/react/24/outline"; 2 2 import type { ChangeEvent } from "react"; 3 - import { useEffect, useId, useState } from "react"; 3 + import { memo, useEffect, useId, useState } from "react"; 4 4 import { toast } from "sonner"; 5 5 import ThumbnailsShimmer from "@/components/Shared/Shimmer/ThumbnailsShimmer"; 6 6 import { Spinner } from "@/components/Shared/UI"; ··· 186 186 ); 187 187 }; 188 188 189 - export default ChooseThumbnail; 189 + export default memo(ChooseThumbnail);
+2 -1
apps/web/src/components/Composer/LinkPreviews.tsx
··· 1 + import { memo } from "react"; 1 2 import Oembed from "@/components/Shared/Post/Oembed"; 2 3 import getURLs from "@/helpers/getURLs"; 3 4 import { usePostAttachmentStore } from "@/store/non-persisted/post/usePostAttachmentStore"; ··· 19 20 ); 20 21 }; 21 22 22 - export default LinkPreviews; 23 + export default memo(LinkPreviews);
+2 -2
apps/web/src/components/Composer/NewAttachments.tsx
··· 1 1 import { XMarkIcon } from "@heroicons/react/24/solid"; 2 2 import { MAX_IMAGE_UPLOAD } from "@hey/data/constants"; 3 3 import type { NewAttachment } from "@hey/types/misc"; 4 - import { useEffect, useRef } from "react"; 4 + import { memo, useEffect, useRef } from "react"; 5 5 import ChooseThumbnail from "@/components/Composer/ChooseThumbnail"; 6 6 import Audio from "@/components/Shared/Audio"; 7 7 import { Image } from "@/components/Shared/UI"; ··· 132 132 ) : null; 133 133 }; 134 134 135 - export default NewAttachments; 135 + export default memo(NewAttachments);