fix: event table fails to render in detail view

The `EventsTable` component failed to render in the detail view, because the `onDataLoad` property is called but none was provided. See the issue for details.

Add a nullcheck to `onDataLoad` before calling it.

Refs #495
This commit is contained in:
Alexander Klein 2021-02-21 10:31:23 +01:00
parent 7eb0ca8034
commit f357916042

View File

@ -19,7 +19,7 @@ export default function EventsTable({ websiteId, ...props }) {
function handleDataLoad(data) {
setEventTypes([...new Set(data.map(({ x }) => x.split('\t')[0]))]);
props.onDataLoad(data);
props.onDataLoad?.(data);
}
return (