mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-18 15:20:25 +08:00
fix: 修复warning 报错
This commit is contained in:
parent
61b997665c
commit
f816165222
@ -9,10 +9,6 @@ import { Link } from 'react-router-dom';
|
||||
import { fetchNewsData, fetchMoreNews } from '../../reducer/modules/news.js';
|
||||
import { fetchInterfaceList } from '../../reducer/modules/interface.js';
|
||||
import ErrMsg from '../ErrMsg/ErrMsg.js';
|
||||
// const jsondiffpatch = require('jsondiffpatch/public/build/jsondiffpatch-full.js');
|
||||
// const formattersHtml = require('jsondiffpatch/public/build/jsondiffpatch-formatters.js').html;
|
||||
// import 'jsondiffpatch/public/formatters-styles/annotated.css';
|
||||
// import 'jsondiffpatch/public/formatters-styles/html.css';
|
||||
const jsondiffpatch = require('jsondiffpatch/dist/jsondiffpatch.umd.js');
|
||||
const formattersHtml = jsondiffpatch.formatters.html;
|
||||
import 'jsondiffpatch/dist/formatters-styles/annotated.css';
|
||||
|
@ -224,9 +224,11 @@ class InterfaceEditForm extends Component {
|
||||
try {
|
||||
this.props.form.validateFields((err, values) => {
|
||||
setTimeout(() => {
|
||||
this.setState({
|
||||
submitStatus: false
|
||||
});
|
||||
if (this._isMounted) {
|
||||
this.setState({
|
||||
submitStatus: false
|
||||
});
|
||||
}
|
||||
}, 3000);
|
||||
if (!err) {
|
||||
values.desc = this.editor.getHtml();
|
||||
@ -364,6 +366,7 @@ class InterfaceEditForm extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
EditFormContext = this;
|
||||
this._isMounted = true;
|
||||
this.setState({
|
||||
req_radio_type: HTTP_METHOD[this.state.method].request_body ? 'req-body' : 'req-query'
|
||||
});
|
||||
@ -384,6 +387,8 @@ class InterfaceEditForm extends Component {
|
||||
|
||||
componentWillUnmount() {
|
||||
EditFormContext.props.changeEditStatus(false);
|
||||
EditFormContext = null;
|
||||
this._isMounted = false;
|
||||
}
|
||||
|
||||
addParams = (name, data) => {
|
||||
|
@ -52,12 +52,18 @@ class ProjectEnv extends Component {
|
||||
}
|
||||
|
||||
async componentWillMount() {
|
||||
this._isMounted = true;
|
||||
await this.props.getProject(this.props.projectId);
|
||||
const { env, _id } = this.props.projectMsg;
|
||||
this.initState(env, _id);
|
||||
this.handleClick(0, env[0]);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
this._isMounted = false;
|
||||
}
|
||||
|
||||
handleClick = (key, data) => {
|
||||
this.setState({
|
||||
currentEnvMsg: data,
|
||||
@ -106,7 +112,9 @@ class ProjectEnv extends Component {
|
||||
this.props.getProject(this.props.projectId);
|
||||
this.props.getEnv(this.props.projectId);
|
||||
message.success('修改成功! ');
|
||||
this.setState({ ...assignValue });
|
||||
if(this._isMounted) {
|
||||
this.setState({ ...assignValue });
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user