@@ -33,6 +33,7 @@ import { canAddNewModeledMethod } from "../../model-editor/shared/multiple-model
3333import { DataGridCell , DataGridRow } from "../common/DataGrid" ;
3434import { validateModeledMethods } from "../../model-editor/shared/validation" ;
3535import { ModeledMethodAlert } from "../method-modeling/ModeledMethodAlert" ;
36+ import { createEmptyModeledMethod } from "../../model-editor/modeled-method-empty" ;
3637
3738const ApiOrMethodRow = styled . div `
3839 min-height: calc(var(--input-height) * 1px);
@@ -165,15 +166,10 @@ const ModelableMethodRow = forwardRef<HTMLElement | undefined, MethodRowProps>(
165166 ) ;
166167
167168 const handleAddModelClick = useCallback ( ( ) => {
168- const newModeledMethod : ModeledMethod = {
169- type : "none" ,
170- provenance : "manual" ,
171- signature : method . signature ,
172- packageName : method . packageName ,
173- typeName : method . typeName ,
174- methodName : method . methodName ,
175- methodParameters : method . methodParameters ,
176- } ;
169+ const newModeledMethod : ModeledMethod = createEmptyModeledMethod (
170+ "none" ,
171+ method ,
172+ ) ;
177173 const newModeledMethods = [ ...modeledMethods , newModeledMethod ] ;
178174 onChange ( method . signature , newModeledMethods ) ;
179175 } , [ method , modeledMethods , onChange ] ) ;
@@ -356,17 +352,7 @@ function modeledMethodsToDisplay(
356352 viewState : ModelEditorViewState ,
357353) : ModeledMethod [ ] {
358354 if ( modeledMethods . length === 0 ) {
359- return [
360- {
361- type : "none" ,
362- provenance : "manual" ,
363- signature : method . signature ,
364- packageName : method . packageName ,
365- typeName : method . typeName ,
366- methodName : method . methodName ,
367- methodParameters : method . methodParameters ,
368- } ,
369- ] ;
355+ return [ createEmptyModeledMethod ( "none" , method ) ] ;
370356 }
371357
372358 if ( viewState . showMultipleModels ) {
0 commit comments