mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
fix: package child components gives undefined in api call
removes ununsed code packageMeta should be required props
This commit is contained in:
parent
5b60be0c06
commit
4b8193041b
2 changed files with 5 additions and 9 deletions
|
@ -47,13 +47,13 @@ export default class PackageSidebar extends React.Component {
|
|||
render() {
|
||||
let {packageMeta} = this.state;
|
||||
|
||||
return (
|
||||
<aside>
|
||||
return packageMeta ?
|
||||
(<aside>
|
||||
<LastSync packageMeta={packageMeta} />
|
||||
<Maintainers packageMeta={packageMeta} />
|
||||
<Dependencies packageMeta={packageMeta} />
|
||||
{/* Package management module? Help us implement it! */}
|
||||
</aside>
|
||||
);
|
||||
</aside>):
|
||||
(<aside>Loading package information...</aside>);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,10 @@ import classes from './style.scss';
|
|||
|
||||
export default class LastSync extends React.Component {
|
||||
static propTypes = {
|
||||
packageMeta: PropTypes.object
|
||||
packageMeta: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
get lastUpdate() {
|
||||
if (!this.props.packageMeta) return 'Loading...';
|
||||
|
||||
let lastUpdate = 0;
|
||||
Object.keys(this.props.packageMeta._uplinks).forEach((upLinkName) => {
|
||||
const status = this.props.packageMeta._uplinks[upLinkName];
|
||||
|
@ -25,8 +23,6 @@ export default class LastSync extends React.Component {
|
|||
}
|
||||
|
||||
get recentReleases() {
|
||||
if (!this.props.packageMeta) return [];
|
||||
|
||||
let recentReleases = Object.keys(this.props.packageMeta.time).map((version) => {
|
||||
return {
|
||||
version,
|
||||
|
|
Loading…
Add table
Reference in a new issue