Skip to content

Commit 5a231f2

Browse files
authored
Fix: Live Query Subscription Error Event (#1193)
Similar to #1151
1 parent 75c0095 commit 5a231f2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/LiveQueryClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class LiveQueryClient extends EventEmitter {
381381
if (data.requestId) {
382382
if (subscription) {
383383
subscription.subscribePromise.resolve();
384-
subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error);
384+
setTimeout(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.ERROR, data.error), 200);
385385
}
386386
} else {
387387
this.emit(CLIENT_EMMITER_TYPES.ERROR, data.error);

src/__tests__/LiveQueryClient-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ describe('LiveQueryClient', () => {
244244

245245
liveQueryClient._handleWebSocketMessage(event);
246246

247+
jest.runOnlyPendingTimers();
247248
expect(isChecked).toBe(true);
248249
});
249250

0 commit comments

Comments
 (0)