vue2-excel-grid 2.0.1 → 2.0.2
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.
package/package.json
CHANGED
|
@@ -2402,7 +2402,20 @@ const ExcelGridComponent = {
|
|
|
2402
2402
|
naturalGridWidth() {
|
|
2403
2403
|
if (this.widthMode === 'auto') this.$nextTick(this.syncHeaderViewportWidth)
|
|
2404
2404
|
},
|
|
2405
|
-
widthMode() { this.$nextTick(this.syncHeaderViewportWidth) }
|
|
2405
|
+
widthMode() { this.$nextTick(this.syncHeaderViewportWidth) },
|
|
2406
|
+
|
|
2407
|
+
// localSyncKey feature — mounted() only calls _loadLocalVersionsOnMount()
|
|
2408
|
+
// once, at mount time. Without this watcher, a key that starts empty (a
|
|
2409
|
+
// host conditionally passing `:local-sync-key="ready ? id : null"`, or
|
|
2410
|
+
// one only known after an async load) and later becomes truthy would
|
|
2411
|
+
// never load its version list, never promote a leftover buffer, and
|
|
2412
|
+
// never show the toolbar badge — the feature would look "broken" for the
|
|
2413
|
+
// rest of that page's lifetime even though everything else works.
|
|
2414
|
+
localSyncKey(newKey, oldKey) {
|
|
2415
|
+
if (newKey === oldKey) return
|
|
2416
|
+
this.localSyncAvailable = false
|
|
2417
|
+
if (newKey) this._loadLocalVersionsOnMount()
|
|
2418
|
+
}
|
|
2406
2419
|
},
|
|
2407
2420
|
|
|
2408
2421
|
created() {
|
|
@@ -6308,14 +6321,18 @@ const ExcelGridComponent = {
|
|
|
6308
6321
|
// turns it into a real version next time the grid mounts.
|
|
6309
6322
|
_scheduleBufferWrite(data) {
|
|
6310
6323
|
if (!this.localSyncKey) return
|
|
6324
|
+
const key = this.localSyncKey // captured now, not re-read 800ms later —
|
|
6325
|
+
// a host that swaps localSyncKey mid-edit (rare, but now reactive, see
|
|
6326
|
+
// the localSyncKey watcher above) must not have this land under the
|
|
6327
|
+
// NEW key with the OLD key's data.
|
|
6311
6328
|
clearTimeout(this._bufferWriteTimer)
|
|
6312
|
-
this._bufferWriteTimer = setTimeout(() => { this._writeBufferNow(data) }, 800)
|
|
6329
|
+
this._bufferWriteTimer = setTimeout(() => { this._writeBufferNow(key, data) }, 800)
|
|
6313
6330
|
},
|
|
6314
6331
|
|
|
6315
|
-
async _writeBufferNow(data) {
|
|
6316
|
-
if (!
|
|
6332
|
+
async _writeBufferNow(key, data) {
|
|
6333
|
+
if (!key) return
|
|
6317
6334
|
try {
|
|
6318
|
-
await putBuffer(
|
|
6335
|
+
await putBuffer(key, data)
|
|
6319
6336
|
} catch (error) {
|
|
6320
6337
|
this.$emit('local-sync-error', { action: 'save', error })
|
|
6321
6338
|
}
|
|
@@ -6405,7 +6422,7 @@ const ExcelGridComponent = {
|
|
|
6405
6422
|
// the version-store write below is best-effort on top of it, reliable
|
|
6406
6423
|
// for the common case (tab switch/background, page stays alive).
|
|
6407
6424
|
clearTimeout(this._bufferWriteTimer)
|
|
6408
|
-
this._writeBufferNow(data)
|
|
6425
|
+
this._writeBufferNow(this.localSyncKey, data)
|
|
6409
6426
|
try {
|
|
6410
6427
|
const hash = sync ? hashRows(data) : await hashRowsAsync(data)
|
|
6411
6428
|
if (this.data !== data) return // data changed again mid-hash — a later flush will catch it
|