File tree Expand file tree Collapse file tree 2 files changed +36
-31
lines changed
components/workflowEngine/ui
views/detectors/components/forms/common Expand file tree Collapse file tree 2 files changed +36
-31
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import {Disclosure} from '@sentry/scraps/disclosure';
44import { Stack } from '@sentry/scraps/layout' ;
55import { Heading , Text } from '@sentry/scraps/text' ;
66
7+ import { ErrorBoundary } from 'sentry/components/errorBoundary' ;
8+
79type FormSectionProps = {
810 title : React . ReactNode ;
911 children ?: React . ReactNode ;
@@ -24,30 +26,32 @@ export function FormSection({
2426 defaultExpanded = true ,
2527} : FormSectionProps ) {
2628 return (
27- < Disclosure
28- as = "section"
29- size = "md"
30- role = "region"
31- defaultExpanded = { defaultExpanded }
32- className = { className }
33- >
34- < Disclosure . Title trailingItems = { trailingItems } >
35- < Heading as = "h3" >
36- { step ? `${ step } . ` : '' }
37- { title }
38- </ Heading >
39- </ Disclosure . Title >
40- < Disclosure . Content >
41- < Stack gap = "lg" >
42- { description && (
43- < FormSectionDescription as = "p" variant = "secondary" >
44- { description }
45- </ FormSectionDescription >
46- ) }
47- < Stack gap = "md" > { children } </ Stack >
48- </ Stack >
49- </ Disclosure . Content >
50- </ Disclosure >
29+ < ErrorBoundary mini >
30+ < Disclosure
31+ as = "section"
32+ size = "md"
33+ role = "region"
34+ defaultExpanded = { defaultExpanded }
35+ className = { className }
36+ >
37+ < Disclosure . Title trailingItems = { trailingItems } >
38+ < Heading as = "h3" >
39+ { step ? `${ step } . ` : '' }
40+ { title }
41+ </ Heading >
42+ </ Disclosure . Title >
43+ < Disclosure . Content >
44+ < Stack gap = "lg" >
45+ { description && (
46+ < FormSectionDescription as = "p" variant = "secondary" >
47+ { description }
48+ </ FormSectionDescription >
49+ ) }
50+ < Stack gap = "md" > { children } </ Stack >
51+ </ Stack >
52+ </ Disclosure . Content >
53+ </ Disclosure >
54+ </ ErrorBoundary >
5155 ) ;
5256}
5357
Original file line number Diff line number Diff line change 1+ import { useMemo } from 'react' ;
2+
13import { useFormField } from 'sentry/components/workflowEngine/form/useFormField' ;
24import type { Project } from 'sentry/types/project' ;
35import { useProjects } from 'sentry/utils/useProjects' ;
46
5- /**
6- * Returns the current project based on the form's `projectId` field.
7- * Reactively updates when the user changes the project in the form.
8- *
9- * Must be used within a Form that has a `projectId` field.
10- */
117export function useDetectorFormProject ( ) : Project {
128 const projectId = useFormField < string > ( 'projectId' ) ;
139 const { projects} = useProjects ( ) ;
14- const project = projects . find ( p => p . id === projectId ) ;
10+ const project = useMemo (
11+ ( ) => projects . find ( p => p . id === projectId ) ,
12+ [ projects , projectId ]
13+ ) ;
14+ // There's a top-level spinner when projects are loading, and you can't select a
15+ // project that's not in the ProjectStore, so this should never happen.
1516 if ( ! project ) {
1617 throw new Error (
1718 `useDetectorFormProject: no project found for projectId "${ projectId } "`
You can’t perform that action at this time.
0 commit comments