Repository navigation
feat: chapters dropdown event create - #1430
Conversation
👇 Click on the image for a new way to code review
Legend |
ojeytonwilliams
left a comment
There was a problem hiding this comment.
I agree that admined_chapters is a bit odd, since it's the wrong permission, but I think it's fine for the MVP. I've tracked it in #1435
| const { | ||
| loading: loadingVenues, | ||
| error: errorVenues, | ||
| data: dataVenues, | ||
| } = useChapterVenuesQuery({ variables: { chapterId: chapter } }); | ||
|
|
||
| useEffect(() => { | ||
| resetField('chapter_id', { defaultValue: adminedChapters[0]?.id ?? -1 }); | ||
| }, [adminedChapters]); | ||
|
|
||
| useEffect(() => { | ||
| resetField('venue_id', { | ||
| defaultValue: | ||
| defaultValues.venue_id ?? dataVenues?.chapterVenues[0]?.id ?? -1, | ||
| }); | ||
| }, [dataVenues]); |
There was a problem hiding this comment.
It's a bit out of scope of this PR, but this got me thinking: could we avoid resetting if we pulled the data fetching up into the parent compoenent? i.e. don't create the form until we have all the data and so avoid setting the wrong defaultValue.
There was a problem hiding this comment.
For venues problem would be fact venues belong to chapter. Unless all venues, for corresponding possible admined chapters, are loaded before rendering form, there's bound to be setting default when dataVenues changes, after selected chapter changed.
There was a problem hiding this comment.
That's a shame, but it sounds like some amount of resetting is inevitable. Oh well.
Co-authored-by: Oliver Eyton-Williams <[email protected]>
ojeytonwilliams
left a comment
There was a problem hiding this comment.
Alrighty, this LGTM 👍 Thanks @gikf!

Update README.md).mainbranch of Chapter.Closes #1215
Add newbutton on the events dashboard, leading to/dashboard/events/newroute, with add event form including chapters dropdown.admined_chaptersarray. This can be a bit weird, as permission required for admining chapter -ChapterEditis not the permission required for adding new events -EventCreate.Add newButton is visible only to those with permission to admin chapter.components/EventForm.tsxis due to removal of blank dummy parent element and dedenting the whole form.