@electerm/electerm-react 3.15.76 → 3.15.86

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.
@@ -121,6 +121,7 @@ export default class ErrorBoundary extends React.PureComponent {
121
121
  <img
122
122
  src='https://electerm.org/electerm-wechat-group-qr.jpg'
123
123
  className='mwm-100'
124
+ width={200}
124
125
  />
125
126
  </div>
126
127
  </>
@@ -133,7 +134,7 @@ export default class ErrorBoundary extends React.PureComponent {
133
134
  return (
134
135
  <div className='pd3 error-wrapper'>
135
136
  <div className='pd2y'>
136
- <img src={logoPath1} className='iblock mwm-100' />
137
+ <img src={logoPath1} className='iblock mwm-100' width={100} />
137
138
  </div>
138
139
  <h1>
139
140
  <FrownOutlined className='mg1r iblock' />
@@ -104,13 +104,20 @@ export const getFolderFromFilePath = (filePath, isRemote) => {
104
104
  }
105
105
  }
106
106
 
107
+ function toMs (ms, date) {
108
+ const n = Number(ms)
109
+ if (Number.isFinite(n)) return n
110
+ const d = Number(date)
111
+ return Number.isFinite(d) ? d : 0
112
+ }
113
+
107
114
  export const getLocalFileInfo = async (filePath) => {
108
115
  const statr = await window.fs.statAsync(filePath)
109
116
  const stat = await window.fs.lstatAsync(filePath)
110
117
  return {
111
118
  size: stat.size,
112
- accessTime: stat.atime || stat.atimeMs,
113
- modifyTime: stat.mtime || stat.mtimeMs,
119
+ accessTime: toMs(stat.atimeMs, stat.atime),
120
+ modifyTime: toMs(stat.mtimeMs, stat.mtime),
114
121
  mode: stat.mode,
115
122
  owner: stat.uid,
116
123
  group: stat.gid,
@@ -222,7 +222,7 @@ export default class Sftp extends Component {
222
222
  let aValue = a[sortProp]
223
223
  let bValue = b[sortProp]
224
224
 
225
- if (typeof aValue === 'string') {
225
+ if (typeof aValue === 'string' && typeof bValue === 'string') {
226
226
  aValue = aValue.toLowerCase()
227
227
  bValue = bValue.toLowerCase()
228
228
  return isDesc
@@ -24,7 +24,7 @@ import './vnc.styl'
24
24
  async function loadVncModule () {
25
25
  if (window.novnc) return
26
26
  console.debug('[VNC-CLIENT] Loading noVNC module...')
27
- const mod = await import('@novnc/novnc/core/rfb')
27
+ const mod = await import('@novnc/novnc')
28
28
  window.novnc = {
29
29
  RFB: mod.default
30
30
  }
@@ -31,6 +31,11 @@ export default store => {
31
31
  old,
32
32
  n
33
33
  )
34
+ // Update snapshot immediately before async DB writes to prevent
35
+ // race conditions: a second autoRun firing before the first
36
+ // completes would see stale oldState and re-insert the same items,
37
+ // causing NeDB unique constraint errors.
38
+ refsStatic.add('oldState-' + name, deepCopy(n) || [])
34
39
  await Promise.all([
35
40
  ...removed.map(item => remove(name, item.id)),
36
41
  ...updated.map(item => update(item.id, item, name, false)),
@@ -41,7 +46,6 @@ export default store => {
41
46
  `${name}:order`,
42
47
  newOrder
43
48
  )
44
- refsStatic.add('oldState-' + name, deepCopy(n) || [])
45
49
  if (name === 'bookmarks') {
46
50
  store.bookmarksMap = new Map(
47
51
  n.map(d => [d.id, d])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "3.15.76",
3
+ "version": "3.15.86",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",