File tree Expand file tree Collapse file tree
client/packages/openblocks/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,49 +172,50 @@ export const JSLibraryTree = (props: {
172172 . filter ( ( { name } ) => ! metas [ name ] )
173173 . map ( ( { name } ) => name ) ;
174174 ! ! notExistMetas . length && dispatch ( fetchJSLibraryMetasAction ( notExistMetas ) ) ;
175- } , [ nameAndVersions , metas , dispatch ] ) ;
175+ } , [ ] ) ;
176176
177177 return (
178178 < JSLibraryCollapse
179179 mode = { props . mode }
180180 isSelected = { false }
181181 isOpen = { false }
182- config = { finalMetas . map ( ( meta , idx ) => ( {
183- key : idx ,
184- title : (
185- < div className = { "lib-label" } >
186- < JSLibraryLabel name = { meta . name } version = { meta . latestVersion } />
187- < EditPopover
188- items = { [
189- ...( meta . homepage
190- ? [
191- {
192- text : trans ( "preLoad.viewJSLibraryDocument" ) ,
193- onClick : ( ) => window . open ( meta . homepage , "_blank" ) ,
194- } ,
195- ]
196- : [ ] ) ,
197- ...( meta . deletable
198- ? ( [
199- {
200- text : trans ( "delete" ) ,
201- onClick : ( ) => {
202- props . onDelete ( idx ) ;
203- } ,
204- type : "delete" ,
205- } ,
206- ] as const )
207- : [ ] ) ,
208- ] }
209- >
210- < Icon tabIndex = { - 1 } />
211- </ EditPopover >
212- </ div >
213- ) ,
214- data : (
215- < JSLibraryInfo description = { meta . description ?? meta . url } exportedAs = { meta . exportedAs } />
216- ) ,
217- } ) ) }
182+ config = { finalMetas . map ( ( meta , idx ) => {
183+ const options = [ ] ;
184+ if ( meta . homepage ) {
185+ options . push ( {
186+ text : trans ( "preLoad.viewJSLibraryDocument" ) ,
187+ onClick : ( ) => window . open ( meta . homepage , "_blank" ) ,
188+ } ) ;
189+ }
190+ if ( meta . deletable ) {
191+ options . push ( {
192+ text : trans ( "delete" ) ,
193+ onClick : ( ) => {
194+ props . onDelete ( idx ) ;
195+ } ,
196+ type : "delete" ,
197+ } as const ) ;
198+ }
199+ return {
200+ key : idx ,
201+ title : (
202+ < div className = { "lib-label" } >
203+ < JSLibraryLabel name = { meta . name } version = { meta . latestVersion } />
204+ { ! ! options . length && (
205+ < EditPopover items = { options } >
206+ < Icon tabIndex = { - 1 } />
207+ </ EditPopover >
208+ ) }
209+ </ div >
210+ ) ,
211+ data : (
212+ < JSLibraryInfo
213+ description = { meta . description ?? meta . url }
214+ exportedAs = { meta . exportedAs }
215+ />
216+ ) ,
217+ } ;
218+ } ) }
218219 />
219220 ) ;
220221} ;
You can’t perform that action at this time.
0 commit comments