Web: fix race condition where job/task update comes in before table is init
Tabulator can't handle data changes before it's been initialised. If there is a race condition and a job/task update comes in before that, just ignore the update. It might be better to use Vue's `nextTick()` function to defer the update until Tabulator is ready to receive it, but doing so in a reliable way might be tricky.
This commit is contained in:
parent
30a30f154b
commit
0a3009d6ed
@ -123,11 +123,17 @@ export default {
|
|||||||
processJobUpdate(jobUpdate) {
|
processJobUpdate(jobUpdate) {
|
||||||
// updateData() will only overwrite properties that are actually set on
|
// updateData() will only overwrite properties that are actually set on
|
||||||
// jobUpdate, and leave the rest as-is.
|
// jobUpdate, and leave the rest as-is.
|
||||||
this.tabulator.updateData([jobUpdate])
|
if (this.tabulator.initialized) {
|
||||||
.then(this.sortData);
|
this.tabulator.updateData([jobUpdate])
|
||||||
|
.then(this.sortData);
|
||||||
|
}
|
||||||
this._refreshAvailableStatuses();
|
this._refreshAvailableStatuses();
|
||||||
},
|
},
|
||||||
processNewJob(jobUpdate) {
|
processNewJob(jobUpdate) {
|
||||||
|
if (this.tabulator.initialized) {
|
||||||
|
this.tabulator.updateData([jobUpdate])
|
||||||
|
.then(this.sortData);
|
||||||
|
}
|
||||||
this.tabulator.addData([jobUpdate])
|
this.tabulator.addData([jobUpdate])
|
||||||
.then(this.sortData);
|
.then(this.sortData);
|
||||||
this._refreshAvailableStatuses();
|
this._refreshAvailableStatuses();
|
||||||
|
@ -128,8 +128,10 @@ export default {
|
|||||||
processTaskUpdate(taskUpdate) {
|
processTaskUpdate(taskUpdate) {
|
||||||
// updateData() will only overwrite properties that are actually set on
|
// updateData() will only overwrite properties that are actually set on
|
||||||
// taskUpdate, and leave the rest as-is.
|
// taskUpdate, and leave the rest as-is.
|
||||||
this.tabulator.updateData([taskUpdate])
|
if (this.tabulator.initialized) {
|
||||||
.then(this.sortData);
|
this.tabulator.updateData([taskUpdate])
|
||||||
|
.then(this.sortData);
|
||||||
|
}
|
||||||
this._refreshAvailableStatuses();
|
this._refreshAvailableStatuses();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user