Skip to content

fix(dashboard): fix crash on event dashboard when user is both organizer and gatekeeper#1071

Merged
WaDadidou merged 3 commits into
mainfrom
fix/dashboard-event-organizer-gatekeeper-form-crash
Jun 1, 2026
Merged

fix(dashboard): fix crash on event dashboard when user is both organizer and gatekeeper#1071
WaDadidou merged 3 commits into
mainfrom
fix/dashboard-event-organizer-gatekeeper-form-crash

Conversation

@WaDadidou

@WaDadidou WaDadidou commented Jun 1, 2026

Copy link
Copy Markdown
Member

Fixes #1070

Summary

  • When a user had both organizer and gatekeeper roles on an event, the dashboard layout took the gatekeeper-only early-return path, skipping DashboardEventEditionContextProvider.
  • Without that provider, react-hook-form's FormProvider was never mounted, so useFormContext() returned null inside DashboardEventGeneral.
  • Calling form.handleSubmit(save) on that null value caused the full page crash.
  • Fix: tighten the condition to only skip the edition provider when the user is not an organizer.

Test plan

  • Log in as a user who is both organizer and gatekeeper of an event.
  • Open /dashboard/event/<id> - page should render without error.
  • Confirm the event edit form is visible and functional (save button works).
  • Log in as a user who is only a gatekeeper - confirm the read-only view still works as before.

…zer and gatekeeper

When a user had both the organizer and gatekeeper roles on an event, the
layout early-returned the gatekeeper-only path, which skips wrapping
children with DashboardEventEditionContextProvider. This left
useFormContext() with no FormProvider, causing a null reference crash
when DashboardEventGeneral tried to call form.handleSubmit().

The fix tightens the condition: only skip the edition context provider
when the user is a gatekeeper and NOT an organizer.
@WaDadidou WaDadidou self-assigned this Jun 1, 2026
@netlify

netlify Bot commented Jun 1, 2026

Copy link
Copy Markdown

Deploy Preview for zenao ready!

Name Link
🔨 Latest commit 053ab7b
🔍 Latest deploy log https://app.netlify.com/projects/zenao/deploys/6a1d99b764943b0008cc3756
😎 Deploy Preview https://deploy-preview-1071--zenao.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

WaDadidou and others added 2 commits June 1, 2026 16:35
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).
@WaDadidou WaDadidou merged commit cb904d8 into main Jun 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(dashboard): crash on event dashboard when user is both organizer and gatekeeper

1 participant