This commit is contained in:
Nathan Bierema 2024-08-25 22:40:21 -04:00
parent 6bed513a9b
commit 5297b47831
2 changed files with 4 additions and 4 deletions

View File

@ -64,17 +64,17 @@ export class TestTab<S, A extends Action<string>> extends Component<
this.setState({ dialogStatus: null }); this.setState({ dialogStatus: null });
}; };
handleSubmit = ({ formData: template }: { formData: Template }) => { handleSubmit = ({ formData: template }: { formData?: Template }) => {
const { templates = getDefaultTemplates(), selected = 0 } = const { templates = getDefaultTemplates(), selected = 0 } =
this.getPersistedState(); this.getPersistedState();
if (this.state.dialogStatus === 'Add') { if (this.state.dialogStatus === 'Add') {
this.updateState({ this.updateState({
selected: templates.length, selected: templates.length,
templates: [...templates, template], templates: [...templates, template!],
}); });
} else { } else {
const editedTemplates = [...templates]; const editedTemplates = [...templates];
editedTemplates[selected] = template; editedTemplates[selected] = template!;
this.updateState({ this.updateState({
templates: editedTemplates, templates: editedTemplates,
}); });

View File

@ -9,7 +9,7 @@ import customWidgets from './widgets';
const FormContainer = createStyledComponent(styles, JSONSchemaForm); const FormContainer = createStyledComponent(styles, JSONSchemaForm);
export interface Props<T> extends FormProps<T> { export interface Props<T> extends Omit<FormProps<T>, 'validator'> {
children?: React.ReactNode; children?: React.ReactNode;
submitText?: string; submitText?: string;
primaryButton?: boolean; primaryButton?: boolean;