File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed
packages/app/src/app/pages/Sandbox/SearchDependencies Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,7 @@ export default class DependencyHit extends React.PureComponent {
4444 }
4545
4646 makeSearchUrl ( hitName ) {
47- return `${
48- process . env . CODESANDBOX_HOST
49- } /search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${ hitName } &page=1`;
47+ return `${ process . env . CODESANDBOX_HOST } /search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${ hitName } &page=1` ;
5048 }
5149
5250 stopPropagation ( e ) {
@@ -133,20 +131,22 @@ export default class DependencyHit extends React.PureComponent {
133131 < SearchIcon />
134132 </ IconLink >
135133 </ Tooltip >
136- < StyledSelect
137- onClick = { this . stopPropagation }
138- onChange = { this . handleVersionChange }
139- value = { this . state . selectedVersion }
140- >
141- { versions . map ( v => {
142- const tagName = getTagName ( hit . tags , v ) ;
143- return (
144- < option value = { v } key = { v } >
145- { v } { tagName && `- ${ tagName } ` }
146- </ option >
147- ) ;
148- } ) }
149- </ StyledSelect >
134+ { hit . tags && (
135+ < StyledSelect
136+ onClick = { this . stopPropagation }
137+ onChange = { this . handleVersionChange }
138+ value = { this . state . selectedVersion }
139+ >
140+ { versions . map ( v => {
141+ const tagName = getTagName ( hit . tags , v ) ;
142+ return (
143+ < option value = { v } key = { v } >
144+ { v } { tagName && `- ${ tagName } ` }
145+ </ option >
146+ ) ;
147+ } ) }
148+ </ StyledSelect >
149+ ) }
150150 </ Row >
151151 </ Right >
152152 </ Container >
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ function getVersion(value: string, hit) {
3535function getIsValid ( value : string , hit , version : string ) {
3636 return Boolean (
3737 hit &&
38+ hit . tags &&
39+ hit . versions &&
3840 hit . name . startsWith ( getName ( value ) ) &&
3941 ( version in hit . tags || version in hit . versions )
4042 ) ;
You can’t perform that action at this time.
0 commit comments