mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-02 20:32:39 +02:00
Merge pull request #1063 from JoeMakuta/optimize/memoize-chunk-card
refactor: memoize ChunkCard component for performance optimization
This commit is contained in:
commit
5ae5a671e7
1 changed files with 3 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import { BookOpen, ChevronDown, ExternalLink, FileText, Hash, Sparkles, X } from
|
|||
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import type React from "react";
|
||||
import { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { forwardRef, memo, type ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { MarkdownViewer } from "@/components/markdown-viewer";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
|
@ -55,7 +55,7 @@ interface ChunkCardProps {
|
|||
disableLayoutAnimation?: boolean;
|
||||
}
|
||||
|
||||
const ChunkCard = forwardRef<HTMLDivElement, ChunkCardProps>(
|
||||
const ChunkCard = memo(forwardRef<HTMLDivElement, ChunkCardProps>(
|
||||
({ chunk, index, totalChunks, isCited }, ref) => {
|
||||
return (
|
||||
<div
|
||||
|
|
@ -101,7 +101,7 @@ const ChunkCard = forwardRef<HTMLDivElement, ChunkCardProps>(
|
|||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
));
|
||||
ChunkCard.displayName = "ChunkCard";
|
||||
|
||||
export function SourceDetailPanel({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue