Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef } from "react";
import { memo, useEffect, useRef } from "react";

import { makeReactChildren, tokenizeANSIString } from "./Ansi.tsx";

Expand All @@ -17,7 +17,7 @@ declare global {
}

// Console output line
export const ConsoleLine = (props: ConsoleLineProps) => {
export const ConsoleLine = memo(function ConsoleLine(props: ConsoleLineProps) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After wrapping the component with memo, the resulting component's name was not automatically inferred, causing ESLint to flag a "missing displayName" error. By defining the component with a named function rather than the arrow syntax, React infers the displayName automatically.

Copy link
Contributor

@felipecrs felipecrs Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. That's the exact same thing I did here:

image

const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const height = ref.current ? ref.current.getBoundingClientRect().height : 0;
Expand Down Expand Up @@ -66,4 +66,4 @@ export const ConsoleLine = (props: ConsoleLineProps) => {
</div>
</pre>
);
};
});