@electerm/electerm-react 3.1.16 → 3.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,13 +33,16 @@ export const dbNames = [
33
33
  'terminalCommandHistory',
34
34
  'aiChatHistory'
35
35
  ]
36
-
37
- export const dbNamesForWatch = [
36
+ export const dbNamesForSync = [
38
37
  ...without(
39
38
  Object.keys(settingMap),
40
39
  settingMap.setting,
41
40
  settingMap.widgets
42
- ),
41
+ )
42
+ ]
43
+
44
+ export const dbNamesForWatch = [
45
+ ...dbNamesForSync,
43
46
  'history',
44
47
  'terminalCommandHistory',
45
48
  'aiChatHistory'
@@ -22,14 +22,15 @@ const e = window.translate
22
22
 
23
23
  export default function useQuickCmds (form, formData) {
24
24
  function renderItem (field, i, add, remove) {
25
+ const { key, ...rest } = field
25
26
  return (
26
27
  <Space
27
28
  style={{ display: 'flex', marginBottom: '2px' }}
28
29
  align='baseline'
29
- key={field.key}
30
+ key={field.key + 'quickCmd' + i}
30
31
  >
31
32
  <FormItem
32
- {...field}
33
+ {...rest}
33
34
  name={[field.name, 'name']}
34
35
  fieldKey={[field.fieldKey, 'first']}
35
36
  rules={[{ required: true, max: 30 }]}
@@ -37,9 +38,9 @@ export default function useQuickCmds (form, formData) {
37
38
  <Input placeholder={e('quickCommandName')} />
38
39
  </FormItem>
39
40
  <FormItem
40
- {...field}
41
+ {...rest}
41
42
  name={[field.name, 'command']}
42
- fieldKey={[field.fieldKey, 'first']}
43
+ fieldKey={[field.fieldKey, 'second']}
43
44
  rules={[{ required: true, max: 300 }]}
44
45
  >
45
46
  <Input placeholder={e('quickCommand')} />
@@ -126,6 +126,7 @@ export default () => {
126
126
  showModal: 0,
127
127
 
128
128
  // setting sync related
129
+ autoSyncReady: false,
129
130
  isSyncingSetting: false,
130
131
  isSyncUpload: false,
131
132
  isSyncDownload: false,
@@ -206,6 +206,13 @@ export default (Store) => {
206
206
  },
207
207
  1000
208
208
  )
209
+ setTimeout(
210
+ () => {
211
+ console.log('Auto sync is ready')
212
+ store.autoSyncReady = true
213
+ },
214
+ 2000
215
+ )
209
216
  if (store.config.checkUpdateOnStart) {
210
217
  store.onCheckUpdate(false)
211
218
  }
@@ -7,7 +7,7 @@ import copy from 'json-deep-copy'
7
7
  import {
8
8
  settingMap, packInfo, syncTypes, syncDataMaps
9
9
  } from '../common/constants'
10
- import { dbNames, update, getData } from '../common/db'
10
+ import { update, getData } from '../common/db'
11
11
  import fetch from '../common/fetch-from-server'
12
12
  import download from '../common/download'
13
13
  import { fixBookmarks } from '../common/db-fix'
@@ -152,10 +152,8 @@ export default (Store) => {
152
152
  }
153
153
 
154
154
  Store.prototype.uploadSettingAll = async function () {
155
- const { store, onSyncAll, syncCount = 0 } = window
156
- const max = dbNames.length * 2
157
- if (syncCount < max) {
158
- window.syncCount = syncCount + 1
155
+ const { store, onSyncAll } = window
156
+ if (store.autoSyncReady === false) {
159
157
  return
160
158
  }
161
159
  if (onSyncAll) {
@@ -4,7 +4,7 @@
4
4
 
5
5
  import createTitle from '../common/create-title'
6
6
  import { autoRun } from 'manate'
7
- import { update, remove, insert, dbNamesForWatch } from '../common/db'
7
+ import { update, remove, insert, dbNamesForWatch, dbNamesForSync } from '../common/db'
8
8
  import {
9
9
  sftpDefaultSortSettingKey,
10
10
  checkedKeysLsKey,
@@ -68,7 +68,7 @@ export default store => {
68
68
  )
69
69
  }
70
70
  await store.updateLastDataUpdateTime()
71
- if (store.config.autoSync) {
71
+ if (store.config.autoSync && dbNamesForSync.includes(name)) {
72
72
  await store.uploadSettingAll()
73
73
  }
74
74
  return store[name]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "3.1.16",
3
+ "version": "3.1.26",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",