Skip to content

Commit

Permalink
fix(clerk-js): Sanitize props of inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Oct 31, 2023
1 parent c9aca7a commit b64e8cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export const InviteMembersForm = (props: InviteMembersFormProps) => {

const {
props: {
/* eslint-disable @typescript-eslint/no-unused-vars */
setError,
setWarning,
setSuccess,
setInfo,
isFocused,
validatePassword,
setHasPassedComplexity,
hasPassedComplexity,
Expand Down
10 changes: 4 additions & 6 deletions packages/clerk-js/src/ui/elements/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type FormControlProps = Omit<PropsOfComponent<typeof Input>, 'label' | 'placehol
id: FieldId;
isRequired?: boolean;
isOptional?: boolean;
isFocused?: boolean;
onActionClicked?: React.MouseEventHandler;
isDisabled?: boolean;
label?: string | LocalizationKey;
Expand Down Expand Up @@ -263,15 +264,15 @@ export const FormFeedback = (props: FormFeedbackProps) => {
export const FormControl = forwardRef<HTMLInputElement, PropsWithChildren<FormControlProps>>((props, ref) => {
const { t } = useLocalizations();
const card = useCardState();
const [isFocused, setIsFocused] = useState(false);
// const [isFocused, setIsFocused] = useState(false);
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
hasPassedComplexity,
// eslint-disable-next-line @typescript-eslint/no-unused-vars

infoText,
id,
isRequired,
isOptional,
isFocused,
label,
actionLabel,
onActionClicked,
Expand All @@ -294,7 +295,6 @@ export const FormControl = forwardRef<HTMLInputElement, PropsWithChildren<FormCo

const isDisabled = props.isDisabled || card.isLoading;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { validatePassword, ...inputProps } = restInputProps;

const inputElementProps = useMemo(() => {
Expand Down Expand Up @@ -405,11 +405,9 @@ export const FormControl = forwardRef<HTMLInputElement, PropsWithChildren<FormCo
{...inputElementProps}
onFocus={e => {
inputElementProps.onFocus?.(e);
setIsFocused(true);
}}
onBlur={e => {
inputElementProps.onBlur?.(e);
setIsFocused(false);
}}
ref={ref}
placeholder={t(placeholder)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export const sanitizeInputProps = (
obj: ReturnType<typeof useFormField>,
keep?: (keyof ReturnType<typeof useFormField>)[],
) => {
/* eslint-disable */
const {
radioOptions,
validatePassword,
Expand All @@ -190,6 +189,7 @@ export const sanitizeInputProps = (
errorMessageId,
fieldId,
label,
clearFeedback,
...inputProps
} = obj;
/* eslint-enable */
Expand Down

0 comments on commit b64e8cf

Please sign in to comment.