From 369426fc905aba7954ac9ac92fe885644d057768 Mon Sep 17 00:00:00 2001 From: wangxi Date: Mon, 8 Oct 2018 13:32:21 +0800 Subject: [PATCH] fix: App detail create new version --- src/pages/Admin/Apps/Detail/index.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/Admin/Apps/Detail/index.jsx b/src/pages/Admin/Apps/Detail/index.jsx index d6bfd472..29527ebf 100644 --- a/src/pages/Admin/Apps/Detail/index.jsx +++ b/src/pages/Admin/Apps/Detail/index.jsx @@ -2,7 +2,7 @@ import React, { Component, Fragment } from 'react'; import { observer, inject } from 'mobx-react'; import { Link } from 'react-router-dom'; import { translate } from 'react-i18next'; -import { pick, assign, get, capitalize } from 'lodash'; +import _, { pick, assign, get, capitalize } from 'lodash'; import classNames from 'classnames'; import { Icon, Input, Table, Popover, Button, Upload } from 'components/Base'; @@ -78,11 +78,12 @@ export default class AppDetail extends Component { const { appVersionStore, t } = this.props; const { versions } = appVersionStore; - if (!get(versions[0], 'version_id')) { + const newVersion = { name: t('New version'), status: 'Creating', version_id: '' }; + + if (_.find(versions, _.pick(newVersion, ['status', 'version_id']))) { return appVersionStore.info(t('Already create new version')); } - const newVersion = { name: t('New version'), status: 'Creating', version_id: '' }; versions.unshift(newVersion); appVersionStore.currentVersion = newVersion;