Skip to content

Commit

Permalink
fix: error title parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Mar 25, 2024
1 parent 67a2759 commit a1aa41c
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IconFeatures } from '@posthog/icons'
import { LemonButton, LemonTable, LemonTabs, Spinner } from '@posthog/lemon-ui'
import { LemonButton, LemonTable, LemonTabs } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { JSONViewer } from 'lib/components/JSONViewer'
import { Sparkline } from 'lib/lemon-ui/Sparkline'
Expand All @@ -17,11 +17,7 @@ export function SessionRecordingErrors(): JSX.Element {
const { errors, errorsLoading } = useValues(sessionRecordingErrorsLogic)
const { loadErrorClusters, createPlaylist } = useActions(sessionRecordingErrorsLogic)

if (errorsLoading) {
return <Spinner />
}

if (!errors) {
if (!errors && !errorsLoading) {
return (
<LemonButton size="large" type="primary" icon={<IconFeatures />} onClick={() => loadErrorClusters()}>
Automagically find errors
Expand Down Expand Up @@ -110,7 +106,8 @@ export function SessionRecordingErrors(): JSX.Element {
},
},
]}
dataSource={errors}
loading={errorsLoading}
dataSource={errors || []}
expandable={{
expandedRowRender: (cluster) => <ExpandedError error={cluster.sample} />,
}}
Expand Down Expand Up @@ -165,5 +162,5 @@ function parseTitle(error: string): string {
input = error
}

return input.split('\n')[0].trim().substring(0, MAX_TITLE_LENGTH)
return input?.split('\n')[0].trim().substring(0, MAX_TITLE_LENGTH) || error
}

0 comments on commit a1aa41c

Please sign in to comment.