chore: fixing up the test timeout
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
||||
} from '@material-ui/core';
|
||||
import { FormProps, IChangeEvent, withTheme } from '@rjsf/core';
|
||||
import { Theme as MuiTheme } from '@rjsf/material-ui';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
const Form = withTheme(MuiTheme);
|
||||
type Step = {
|
||||
@@ -54,7 +54,6 @@ export const MultistepJsonForm = ({
|
||||
onFinish,
|
||||
}: Props) => {
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [formDataEvent, setFormDataEvent] = useState({ formData: {} });
|
||||
|
||||
const handleReset = () => {
|
||||
setActiveStep(0);
|
||||
@@ -63,9 +62,7 @@ export const MultistepJsonForm = ({
|
||||
const handleNext = () =>
|
||||
setActiveStep(Math.min(activeStep + 1, steps.length));
|
||||
const handleBack = () => setActiveStep(Math.max(activeStep - 1, 0));
|
||||
useEffect(() => {
|
||||
onChange(formDataEvent as IChangeEvent);
|
||||
}, [formDataEvent, onChange]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stepper activeStep={activeStep} orientation="vertical">
|
||||
@@ -77,7 +74,7 @@ export const MultistepJsonForm = ({
|
||||
key={label}
|
||||
noHtml5Validate
|
||||
formData={formData}
|
||||
onChange={e => setFormDataEvent(e)}
|
||||
onChange={onChange}
|
||||
schema={schema as FormProps<any>['schema']}
|
||||
onSubmit={e => {
|
||||
if (e.errors.length === 0) handleNext();
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
import { catalogApiRef } from '@backstage/plugin-catalog';
|
||||
import { LinearProgress } from '@material-ui/core';
|
||||
import { IChangeEvent } from '@rjsf/core';
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { Navigate } from 'react-router';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useAsync } from 'react-use';
|
||||
@@ -86,8 +86,10 @@ export const TemplatePage = () => {
|
||||
const [formState, setFormState] = useState({});
|
||||
|
||||
const handleFormReset = () => setFormState({});
|
||||
const handleChange = (e: IChangeEvent) =>
|
||||
setFormState({ ...formState, ...e.formData });
|
||||
const handleChange = useCallback(
|
||||
(e: IChangeEvent) => setFormState({ ...formState, ...e.formData }),
|
||||
[setFormState, formState],
|
||||
);
|
||||
|
||||
const [jobId, setJobId] = useState<string | null>(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user