Skip to content

Commit

Permalink
Merge pull request #178 from OP-Engineering/oscar/clear-pending-react…
Browse files Browse the repository at this point in the history
…ive-queries

Clear pending reactive queries after firing
  • Loading branch information
ospfranco authored Oct 29, 2024
2 parents 8124ab6 + bf9e684 commit cbc01f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cpp/DBHostObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void DBHostObject::flush_pending_reactive_queries(std::shared_ptr<jsi::Value> re
}
}

pending_reactive_queries.clear();

invoker->invokeAsync(
[this, resolve]() { resolve->asObject(rt).asFunction(rt).call(rt, {}); });
}
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PODS:
- hermes-engine (0.76.0):
- hermes-engine/Pre-built (= 0.76.0)
- hermes-engine/Pre-built (0.76.0)
- op-sqlite (9.2.4):
- op-sqlite (9.2.6):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1785,7 +1785,7 @@ SPEC CHECKSUMS:
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 9de51d2f67336348a6cd5b686330e436d1dbd522
op-sqlite: 298654d710ae6b0e52a23136de40dad579ca3203
op-sqlite: 92fef1bcdad6299e2c87d11c0dc68404ad809d00
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
RCTDeprecation: 4c2c4a088b6f0ccfcbd53c9d5614b0238ad57909
RCTRequired: 2d8a683a7848bc0baf5883f0792c1ac43f6267b5
Expand Down
5 changes: 3 additions & 2 deletions example/src/tests/reactive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export function reactiveTests() {

unsubscribe();

db.execute('UPDATE User SET name = ? WHERE id = ?;', ['Foo', 1]);

await db.transaction(async tx => {
await tx.execute('UPDATE User SET name = ? WHERE id = ?;', ['Foo', 1]);
});
await sleep(20);
expect(emittedCount).to.eq(1);
});
Expand Down

0 comments on commit cbc01f3

Please sign in to comment.