king
2023-01-14 004176924ce35c96600f5c18e85478944de8bec6
src/tabviews/custom/components/code/sand-box/index.jsx
@@ -84,7 +84,19 @@
  }
  componentDidMount () {
    const { config, sync } = this.state
    MKEmitter.addListener('reloadData', this.reloadData)
    if (config.$cache && (config.setting.sync !== 'true' || sync)) {
      Api.getLCacheConfig(config.uuid).then(res => {
        if (!res) return
        this.setState({data: res[0]}, () => {
          this.renderView()
        })
      })
    }
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -110,9 +122,13 @@
        _data = nextProps.data[config.dataName]
      }
      this.setState({sync: false, data: _data}, () => {
        this.renderView()
      })
      this.setState({sync: false, data: _data})
      if (!is(fromJS(this.state.data), fromJS(_data))) {
        setTimeout(() => {
          this.renderView()
        }, 10)
      }
    } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
      this.setState({}, () => {
        this.loadData()
@@ -164,12 +180,20 @@
    if (result.status) {
      let _data = result.data || {}
      if (config.$cache) {
        Api.writeCacheConfig(config.uuid, result.data || '')
      }
      this.setState({
        data: _data,
        loading: false
      }, () => {
        this.renderView()
      })
      if (!is(fromJS(this.state.data), fromJS(_data))) {
        setTimeout(() => {
          this.renderView()
        }, 10)
      }
    } else {
      this.setState({
        loading: false