Skip to content

Commit

Permalink
Follow review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
keisuke-umezawa committed Jun 30, 2024
1 parent 4e1006a commit cc0ab0f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions optuna_dashboard/ts/components/Artifact/TableArtifactViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const TableArtifactViewer: React.FC<TableArtifactViewerProps> = (
const loadedData = await loadData(props)
setData(loadedData)
} catch (error: unknown) {
enqueueSnackbar("Failed to load the file. " + error, {
enqueueSnackbar(`Failed to load the file. ${error}`, {
variant: "error",
})
}
Expand All @@ -47,7 +47,13 @@ export const TableArtifactViewer: React.FC<TableArtifactViewerProps> = (
}, [props])

const columns = React.useMemo(() => {
const keys = data.length > 0 ? Object.keys(data[0]) : []
const unionSet: Set<string> = new Set()
data.forEach((d) => {
Object.keys(d).forEach((key) => {
unionSet.add(key)
})
})
const keys = Array.from(unionSet)
return keys.map((key) => ({
header: key,
accessorFn: (info: Data) =>
Expand Down

0 comments on commit cc0ab0f

Please sign in to comment.