Commit c21df79
committed
fix(dashboard): fix crash on general tab for gatekeeper-only users
useFormContext and useDashboardEventEditionContext were called at the top
of DashboardEventGeneral, but the FormProvider is only mounted for
organizers. React evaluates JSX expressions (including form.handleSubmit)
before RoleBasedViewMode can decide to render the fallback, so the null
form reference crashed even though the form UI was never shown.
Extract the organizer-only content into a sub-component so the form
hooks are only called when the component actually mounts (organizer path).1 parent b1a6efb commit c21df79
1 file changed
Lines changed: 18 additions & 7 deletions
Lines changed: 18 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
41 | 38 | | |
42 | 39 | | |
43 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
44 | 55 | | |
45 | 56 | | |
46 | 57 | | |
0 commit comments