diff --git a/spug_web/src/pages/deploy/request/Ext1Form.js b/spug_web/src/pages/deploy/request/Ext1Form.js index d4f42bb..7439a38 100644 --- a/spug_web/src/pages/deploy/request/Ext1Form.js +++ b/spug_web/src/pages/deploy/request/Ext1Form.js @@ -26,7 +26,7 @@ export default observer(function () { setHostIds(lds.clone(host_ids || app_host_ids)); http.get('/api/repository/', {params: {deploy_id}}) .then(res => setVersions(res)) - if (hostStore.records.length === 0) hostStore.fetchRecords() + if (!hostStore.records || hostStore.records.length === 0) hostStore.fetchRecords() }, []) function handleSubmit() { diff --git a/spug_web/src/pages/deploy/request/Ext2Form.js b/spug_web/src/pages/deploy/request/Ext2Form.js index 992cee2..f257414 100644 --- a/spug_web/src/pages/deploy/request/Ext2Form.js +++ b/spug_web/src/pages/deploy/request/Ext2Form.js @@ -26,7 +26,7 @@ export default observer(function () { useEffect(() => { const {app_host_ids, host_ids, extra} = store.record; setHostIds(lds.clone(host_ids || app_host_ids)); - if (hostStore.records.length === 0) hostStore.fetchRecords(); + if (!hostStore.records || hostStore.records.length === 0) hostStore.fetchRecords(); if (store.record.extra) setFileList([{...extra, uid: '0'}]) }, []) diff --git a/spug_web/src/pages/login/index.js b/spug_web/src/pages/login/index.js index 80a4017..d89b770 100644 --- a/spug_web/src/pages/login/index.js +++ b/spug_web/src/pages/login/index.js @@ -29,7 +29,7 @@ export default function () { appStore.records = []; requestStore.records = []; requestStore.deploys = []; - hostStore.records = []; + hostStore.records = null; execStore.hosts = []; }, []) diff --git a/spug_web/src/pages/schedule/Form.js b/spug_web/src/pages/schedule/Form.js index 20dfbb2..d554978 100644 --- a/spug_web/src/pages/schedule/Form.js +++ b/spug_web/src/pages/schedule/Form.js @@ -16,9 +16,7 @@ import hostStore from '../host/store'; export default observer(function () { useEffect(() => { store.targets = store.record.id ? store.record['targets'] : [undefined]; - if (hostStore.records.length === 0) { - hostStore.fetchRecords() - } + if (!hostStore.records || hostStore.records.length === 0) hostStore.fetchRecords() }, []) return (