Skip to content

Commit

Permalink
fix: not passing onSubmit.event breaks form
Browse files Browse the repository at this point in the history
  • Loading branch information
viet nguyen committed Sep 25, 2023
1 parent 3e784d2 commit 98d20af
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/components/basecamp/OrganizationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ export default function OrganizationForm ({ existingOrg, onClose }: Organization
</div>
<div className='basis-2/3 grow'>
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='min-w-[16em]'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='min-w-[16em]'>
<Input
label='Display Name:'
name='displayName'
Expand Down
3 changes: 2 additions & 1 deletion src/components/basecamp/Organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ const OrganizationTable = (): JSX.Element => {
<span className='ml-2'>Create</span>
</button>
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='flex items-center ml-4'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='flex items-center ml-4'>
<Input
name='displayName'
placeholder='Search by display name'
Expand Down
3 changes: 2 additions & 1 deletion src/components/basecamp/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export default function UserForm ({ user, onClose }: UserFormProps): JSX.Element
</div>
<div className='basis-2/3 grow'>
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='min-w-[16em]'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='min-w-[16em]'>
<MultiSelect
label='Roles:'
name='roles'
Expand Down
3 changes: 2 additions & 1 deletion src/components/basecamp/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ const UserTable = (): JSX.Element => {
<div className='flex items-center justify-between'>
<h2 className=''>Users</h2>
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='flex items-center'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='flex items-center'>
<Input
name='email'
placeholder='Search by email'
Expand Down
3 changes: 2 additions & 1 deletion src/components/crag/cragSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ export default function CragSummary ({ area, history }: CragSummaryProps): JSX.E
)}

<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }}>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)}>
<StickyHeader
ancestors={ancestors}
pathTokens={pathTokens}
Expand Down
3 changes: 2 additions & 1 deletion src/components/edit/AddChildAreaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ const Step1 = (props: ChildAreaBaseProps): JSX.Element => {

return (
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }}>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)}>
<Input
label='Parent:'
name='parentName'
Expand Down
3 changes: 2 additions & 1 deletion src/components/edit/DeleteAreaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export default function DeleteAreaForm ({ areaUuid, areaName, parentUuid, return

return (
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='dialog-form-default'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='dialog-form-default'>
<div>You're about to delete '<span className='font-semibold'>{areaName}</span>'. Type <b>DELETE</b> to confirm.</div>
<Input
label=''
Expand Down
3 changes: 2 additions & 1 deletion src/components/edit/EditAreaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export default function AreaEditForm (props: AreaType & { formRef?: any }): JSX.

return (
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='dialog-form-default'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='dialog-form-default'>
<Input
label='Name:'
name='areaName'
Expand Down
6 changes: 2 additions & 4 deletions src/components/users/account/UpdateProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ export const UpdateProfileForm: React.FC = () => {
<h2 className=''>Edit Profile</h2>

<FormProvider {...form}>
<form
onSubmit={() => { void handleSubmit(submitHandler) }}
className='mt-10 flex flex-col'
>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='mt-10 flex flex-col'>
<Input
name='displayName'
label='Display name'
Expand Down
6 changes: 2 additions & 4 deletions src/components/users/account/UsernameChangeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ export const UsernameChangeForm: React.FC = () => {
<h2>Change username</h2>
</>)}
<FormProvider {...form}>
<form
onSubmit={() => { void handleSubmit(submitHandler) }}
className='mt-10 flex flex-col gap-y-6'
>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='mt-10 flex flex-col gap-y-6'>
{initials != null && <CurrentUsername {...initials} />}
<Input
name='username'
Expand Down
3 changes: 2 additions & 1 deletion src/pages/climbs/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ const Body = ({ climb, leftClimb, rightClimb }: ClimbPageProps): JSX.Element =>
<PhotoMontage photoList={climb.media} isHero />

<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(submitHandler) }} className='mt-6 first:mt-0'>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(submitHandler)} className='mt-6 first:mt-0'>

<StickyHeader
isClimbPage
Expand Down
3 changes: 2 additions & 1 deletion src/pages/edit/addArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ const AddAreaPage: INextPageWithAuth = () => {
<div className='text-xs mt-4'>Area can be a crag, boulder, or a destination containing other smaller areas.</div>
<ProgressSteps />
<FormProvider {...form}>
<form onSubmit={() => { void handleSubmit(onSubmit) }}>
{/* eslint-disable-next-line */}
<form onSubmit={handleSubmit(onSubmit)}>
<div className='mt-8 text-lg text-content-base font-bold'>Location</div>
<Step1a />
<Step1b />
Expand Down

0 comments on commit 98d20af

Please sign in to comment.