Skip to content

Commit

Permalink
Fix types check
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed May 8, 2024
1 parent 0d8988e commit 4a577ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-json-tree/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const JSONTree = ({
data: Record<string, unknown>;
isDarkMode: boolean;
isSingleRow: boolean;
onTreeExpand: () => void;
onTreeExpand?: () => void;
}) => {
return (
<>
Expand Down
16 changes: 9 additions & 7 deletions packages/kbn-unified-data-table/src/components/data_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,17 @@ export const UnifiedDataTable = ({

const toggleRowHeight = useCallback(
(rowIndex: number) => {
// mimimize to single
if (autoHeightRows.includes(rowIndex)) {
setAutoHeightRows(autoHeightRows.filter((e) => e !== rowIndex));
} else {
// expand
setAutoHeightRows([...autoHeightRows, rowIndex]);
if (isPlainRecord) {
// mimimize to single row
if (autoHeightRows.includes(rowIndex)) {
setAutoHeightRows(autoHeightRows.filter((e) => e !== rowIndex));
} else {
// expand
setAutoHeightRows([...autoHeightRows, rowIndex]);
}
}
},
[autoHeightRows]
[autoHeightRows, isPlainRecord]
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ export function SourceDocument({
fieldFormats: FieldFormatsStart;
dataTestSubj?: string;
className?: string;
isDarkMode: boolean;
isSingleRow: boolean;
onTreeExpand: () => void;
isDarkMode?: boolean;
isSingleRow?: boolean;
onTreeExpand?: () => void;
}) {
const pairs: FormattedHit = useTopLevelObjectColumns
? getTopLevelObjectPairs(row.raw, columnId, dataView, shouldShowFieldHandler).slice(
Expand All @@ -68,8 +68,8 @@ export function SourceDocument({
return (
<JSONTree
data={row.raw as unknown as Record<string, unknown>}
isDarkMode={isDarkMode}
isSingleRow={isSingleRow}
isDarkMode={isDarkMode ?? false}
isSingleRow={isSingleRow ?? false}
onTreeExpand={onTreeExpand}
/>
);
Expand Down

0 comments on commit 4a577ef

Please sign in to comment.