Skip to content

Commit

Permalink
fix(persons): Display error when person API fails (#24220)
Browse files Browse the repository at this point in the history
  • Loading branch information
webjunkie authored Aug 7, 2024
1 parent fc8953c commit 9481490
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/scenes/persons/PersonScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function PersonScene(): JSX.Element | null {
feedEnabled,
person,
personLoading,
personError,
currentTab,
splitMergeModalShown,
urlId,
Expand All @@ -113,6 +114,9 @@ export function PersonScene(): JSX.Element | null {
const { groupsEnabled } = useValues(groupsAccessLogic)
const { currentTeam } = useValues(teamLogic)

if (personError) {
throw new Error(personError)
}
if (!person) {
return personLoading ? <SpinnerOverlay sceneLevel /> : <NotFound object="Person" />
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/scenes/persons/personsLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ export const personsLogic = kea<personsLogicType>([
loadPerson: () => null,
setPerson: (_, { person }): PersonType | null => person,
},
personError: [
null as string | null,
{
loadPerson: () => null,
setPerson: () => null,
loadPersonUUID: () => null,
loadPersonFailure: (_, { error }) => error,
},
],
distinctId: [
null as string | null,
{
Expand Down

0 comments on commit 9481490

Please sign in to comment.