subscriber在调用回调之前,应该先同步cache中的数据
This commit is contained in:
parent
94dc93868c
commit
40a98dd51a
|
|
@ -94,11 +94,11 @@ export class SubScriber extends Feature {
|
|||
}
|
||||
});
|
||||
socket.on('data', (opRecords, event) => {
|
||||
this.cache.sync(opRecords);
|
||||
const registered = this.eventMap[event];
|
||||
if (registered) {
|
||||
registered.callbacks.forEach((ele) => ele(event, opRecords));
|
||||
}
|
||||
this.cache.sync(opRecords);
|
||||
});
|
||||
socket.on('error', (errString) => {
|
||||
console.error(errString);
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ class SubScriber extends Feature_1.Feature {
|
|||
}
|
||||
});
|
||||
socket.on('data', (opRecords, event) => {
|
||||
this.cache.sync(opRecords);
|
||||
const registered = this.eventMap[event];
|
||||
if (registered) {
|
||||
registered.callbacks.forEach((ele) => ele(event, opRecords));
|
||||
}
|
||||
this.cache.sync(opRecords);
|
||||
});
|
||||
socket.on('error', (errString) => {
|
||||
console.error(errString);
|
||||
|
|
|
|||
|
|
@ -127,13 +127,13 @@ export class SubScriber<ED extends EntityDict & BaseEntityDict> extends Feature
|
|||
socket.on(
|
||||
'data',
|
||||
(opRecords: OpRecord<ED>[], event: string) => {
|
||||
this.cache.sync(opRecords);
|
||||
const registered = this.eventMap[event];
|
||||
if (registered) {
|
||||
registered.callbacks.forEach(
|
||||
(ele) => ele(event, opRecords)
|
||||
);
|
||||
}
|
||||
this.cache.sync(opRecords);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue