Skip to content

Commit bfc27ad

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: improve rendering time of data page cells with large string values (#41777)
GitOrigin-RevId: 8640d1728e286ce5317aca659ac719ca5cb49aec
1 parent 4dfed72 commit bfc27ad

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

npm-packages/dashboard-common/src/features/data/components/Table/DataCell/DataCellValue.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { forwardRef } from "react";
22
import { isInCommonUTCTimestampRange } from "@common/features/data/lib/helpers";
33
import { Tooltip } from "@ui/Tooltip";
44

5+
// We only render the first bit of a string inside of cells for performance.
6+
const MAX_CHARS_TO_RENDER = 150;
7+
58
type DataCellValueProps = {
69
isDateField: boolean;
710
inferIsDate: boolean;
@@ -52,12 +55,12 @@ export const DataCellValue = forwardRef<HTMLSpanElement, DataCellValueProps>(
5255
<span
5356
className={`before:text-content-secondary before:content-['"'] after:text-content-secondary after:content-['"']`}
5457
>
55-
{stringValue}
58+
{stringValue.slice(0, MAX_CHARS_TO_RENDER)}
5659
</span>
5760
) : value === undefined ? (
5861
<span className="text-content-secondary italic">unset</span>
5962
) : (
60-
<span>{stringValue}</span>
63+
<span>{stringValue.slice(0, MAX_CHARS_TO_RENDER)}</span>
6164
)}
6265
</span>
6366
);

npm-packages/dashboard-common/src/features/data/components/Table/DataRow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ function DataRowLoaded({ index, style, data }: DataRowProps) {
166166
return (
167167
<div
168168
className={classNames(
169+
"animate-fadeInFromLoading",
169170
// Make sure the focus ring is visible on first and last cell
170171
"focus:ring-none focus:border",
171172
didJustCreate && "animate-highlight",

0 commit comments

Comments
 (0)