From afb39f8ab004b2607bb718edab02e99c7a010114 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 三月 2023 14:36:44 +0800
Subject: [PATCH] 2023-03-22

---
 src/tabviews/custom/components/code/sand-box/index.jsx |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx
index a9edce6..8ccc32b 100644
--- a/src/tabviews/custom/components/code/sand-box/index.jsx
+++ b/src/tabviews/custom/components/code/sand-box/index.jsx
@@ -97,7 +97,7 @@
       Api.getLCacheConfig(config.uuid).then(res => {
         if (!res || this.loaded) return
 
-        this.setState({data: res[0]}, () => {
+        this.setState({data: res}, () => {
           this.renderView()
         })
       })
@@ -129,13 +129,13 @@
 
       this.loaded = true
 
-      this.setState({sync: false, data: _data})
-
       if (!is(fromJS(this.state.data), fromJS(_data))) {
         setTimeout(() => {
           this.renderView()
         }, 10)
       }
+
+      this.setState({sync: false, data: _data})
     } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       this.setState({}, () => {
         this.loadData()
@@ -189,20 +189,20 @@
       let _data = result.data || {}
 
       this.loaded = true
-      if (config.$cache) {
+      if (config.$cache && config.setting.onload !== 'false') {
         Api.writeCacheConfig(config.uuid, result.data || '')
+      }
+
+      if (!is(fromJS(this.state.data), fromJS(_data))) {
+        setTimeout(() => {
+          this.renderView()
+        }, 10)
       }
 
       this.setState({
         data: _data,
         loading: false
       })
-      
-      if (!is(fromJS(this.state.data), fromJS(_data))) {
-        setTimeout(() => {
-          this.renderView()
-        }, 10)
-      }
     } else {
       this.setState({
         loading: false

--
Gitblit v1.8.0