@@ -35,7 +35,25 @@ export const ModeledMethodDataGrid = ({
3535 hideModeledApis,
3636 onChange,
3737} : Props ) => {
38- const sortedMethods = useMemo ( ( ) => sortMethods ( methods ) , [ methods ] ) ;
38+ const methodsWithModelability : Array < {
39+ method : Method ;
40+ methodCanBeModeled : boolean ;
41+ } > = useMemo ( ( ) => {
42+ const methodsWithModelability = [ ] ;
43+ for ( const method of sortMethods ( methods ) ) {
44+ const modeledMethod = modeledMethods [ method . signature ] ;
45+ const methodIsUnsaved = modifiedSignatures . has ( method . signature ) ;
46+ const methodCanBeModeled =
47+ ! method . supported ||
48+ ( modeledMethod && modeledMethod ?. type !== "none" ) ||
49+ methodIsUnsaved ;
50+
51+ if ( methodCanBeModeled || ! hideModeledApis ) {
52+ methodsWithModelability . push ( { method, methodCanBeModeled } ) ;
53+ }
54+ }
55+ return methodsWithModelability ;
56+ } , [ hideModeledApis , methods , modeledMethods , modifiedSignatures ] ) ;
3957
4058 return (
4159 < VSCodeDataGrid gridTemplateColumns = { GRID_TEMPLATE_COLUMNS } >
@@ -56,18 +74,18 @@ export const ModeledMethodDataGrid = ({
5674 Kind
5775 </ VSCodeDataGridCell >
5876 </ VSCodeDataGridRow >
59- { sortedMethods . map ( ( method ) => (
77+ { methodsWithModelability . map ( ( { method, methodCanBeModeled } ) => (
6078 < MethodRow
6179 key = { method . signature }
6280 method = { method }
81+ methodCanBeModeled = { methodCanBeModeled }
6382 modeledMethod = { modeledMethods [ method . signature ] }
6483 methodIsUnsaved = { modifiedSignatures . has ( method . signature ) }
6584 modelingInProgress = { inProgressMethods . hasMethod (
6685 packageName ,
6786 method . signature ,
6887 ) }
6988 mode = { mode }
70- hideModeledApis = { hideModeledApis }
7189 onChange = { onChange }
7290 />
7391 ) ) }
0 commit comments