Skip to content

Commit 2a99831

Browse files
committed
Fix table rows prod truncation bug
1 parent a56de4f commit 2a99831

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

web/src/components/common/Markdown.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,24 @@ function ModifiedTable(props: any) {
265265

266266
// Find thead and tbody
267267
children.forEach((child: any) => {
268-
if (child?.type?.name === 'ModifiedThead') {
268+
if (child?.type === ModifiedThead) {
269269
thead = child;
270-
} else if (child?.type?.name === 'ModifiedTbody') {
270+
} else if (child?.type === ModifiedTbody) {
271271
tbody = child;
272272
if (tbody?.props?.children) {
273273
const tbodyChildren = Array.isArray(tbody.props.children) ? tbody.props.children : [tbody.props.children];
274-
totalRows = tbodyChildren.filter((row: any) => row?.type?.name === 'ModifiedTr').length;
274+
totalRows = tbodyChildren.filter((row: any) => row?.type === ModifiedTr).length;
275275
}
276276
}
277277
});
278-
278+
279279
if (!tbody || totalRows <= 3) {
280280
return props.children;
281281
}
282-
282+
283283
// Limit tbody to first 3 rows
284284
const tbodyChildren = Array.isArray(tbody.props.children) ? tbody.props.children : [tbody.props.children];
285-
const visibleRows = tbodyChildren.filter((row: any) => row?.type?.name === 'ModifiedTr').slice(0, 3);
285+
const visibleRows = tbodyChildren.filter((row: any) => row?.type === ModifiedTr).slice(0, 3);
286286
const hiddenRowsCount = totalRows - 3;
287287

288288
// Create modified tbody with limited rows
@@ -316,24 +316,24 @@ function ModifiedTable(props: any) {
316316

317317
// Find thead and tbody
318318
children.forEach((child: any) => {
319-
if (child?.type?.name === 'ModifiedThead') {
319+
if (child?.type === ModifiedThead) {
320320
thead = child;
321-
} else if (child?.type?.name === 'ModifiedTbody') {
321+
} else if (child?.type === ModifiedTbody) {
322322
tbody = child;
323323
if (tbody?.props?.children) {
324324
const tbodyChildren = Array.isArray(tbody.props.children) ? tbody.props.children : [tbody.props.children];
325-
totalRows = tbodyChildren.filter((row: any) => row?.type?.name === 'ModifiedTr').length;
325+
totalRows = tbodyChildren.filter((row: any) => row?.type === ModifiedTr).length;
326326
}
327327
}
328328
});
329-
329+
330330
if (!tbody || totalRows <= 10) {
331331
return props.children;
332332
}
333-
333+
334334
// Limit tbody to first 10 rows
335335
const tbodyChildren = Array.isArray(tbody.props.children) ? tbody.props.children : [tbody.props.children];
336-
const visibleRows = tbodyChildren.filter((row: any) => row?.type?.name === 'ModifiedTr').slice(0, 10);
336+
const visibleRows = tbodyChildren.filter((row: any) => row?.type === ModifiedTr).slice(0, 10);
337337
const hiddenRowsCount = totalRows - 10;
338338

339339
// Create modified tbody with limited rows

0 commit comments

Comments
 (0)