⚡️ memoize StyledMarkdownPreview
This commit is contained in:
parent
2fc57ea57e
commit
ea5abe2a91
2 changed files with 21 additions and 27 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import MarkdownPreview from "@uiw/react-markdown-preview";
|
||||
import { memo } from "react";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
|
|
@ -80,7 +81,9 @@ interface StyledMarkdownPreviewProps {
|
|||
showCodeBorder?: boolean;
|
||||
}
|
||||
|
||||
function StyledMarkdownPreview(props: StyledMarkdownPreviewProps) {
|
||||
const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
||||
props: StyledMarkdownPreviewProps
|
||||
) {
|
||||
return (
|
||||
<StyledMarkdownPreviewComponent
|
||||
components={{
|
||||
|
|
@ -105,6 +108,6 @@ function StyledMarkdownPreview(props: StyledMarkdownPreviewProps) {
|
|||
showBorder={props.showCodeBorder}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default StyledMarkdownPreview;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import {
|
|||
vscForeground,
|
||||
} from "../components";
|
||||
import FTCDialog from "../components/dialogs/FTCDialog";
|
||||
import ErrorStepContainer from "../components/gui/ErrorStepContainer";
|
||||
import StepContainer from "../components/gui/StepContainer";
|
||||
import TimelineItem from "../components/gui/TimelineItem";
|
||||
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
|
||||
|
|
@ -431,30 +430,22 @@ function GUI(props: GUIProps) {
|
|||
}
|
||||
onToggle={() => {}}
|
||||
>
|
||||
{false ? ( // Most of these falses were previously (step.error)
|
||||
<ErrorStepContainer
|
||||
onClose={() => {}}
|
||||
error={undefined}
|
||||
onDelete={() => {}}
|
||||
/>
|
||||
) : (
|
||||
<StepContainer
|
||||
index={index}
|
||||
isLast={index === sessionState.history.length - 1}
|
||||
isFirst={index === 0}
|
||||
open={
|
||||
typeof stepsOpen[index] === "undefined"
|
||||
? true
|
||||
: stepsOpen[index]!
|
||||
}
|
||||
key={index}
|
||||
onUserInput={(input: string) => {}}
|
||||
item={item}
|
||||
onReverse={() => {}}
|
||||
onRetry={() => {}}
|
||||
onDelete={() => {}}
|
||||
/>
|
||||
)}
|
||||
<StepContainer
|
||||
index={index}
|
||||
isLast={index === sessionState.history.length - 1}
|
||||
isFirst={index === 0}
|
||||
open={
|
||||
typeof stepsOpen[index] === "undefined"
|
||||
? true
|
||||
: stepsOpen[index]!
|
||||
}
|
||||
key={index}
|
||||
onUserInput={(input: string) => {}}
|
||||
item={item}
|
||||
onReverse={() => {}}
|
||||
onRetry={() => {}}
|
||||
onDelete={() => {}}
|
||||
/>
|
||||
</TimelineItem>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue