`await tx.isPersisted.promise` is not working
I've been using tanstack/db for about a month now, and the
await tx.isPersisted.promise
has stopped working at some point.
I don't remember which version, but I'm currently on 0.1.27
and it doesn't work.
10 Replies
extended-salmonOP•6h ago
The promise just hangs and eventually it fails. Even though the change is applied and the server API is successful.
extended-salmonOP•6h ago

extended-salmonOP•6h ago
And this is the error:

extended-salmonOP•6h ago
I'm running the delete operation in a transaction on the server and getting the txid with
SELECT pg_current_xact_id()::xid::text as txid
inside an actual transaction.
Any idea on what I could be doing wrong here?
I also tried updating electric to 1.1.14
, but that doesn't seem to help either 🤔foreign-sapphire•6h ago
Can you try running localStorage.debug = '*' in your browser console?
That'll give you some debugging output
Odds are your txid isn't matching right
extended-salmonOP•5h ago
I wonder why that would happen?

extended-salmonOP•5h ago
LMAO, I think I figured it out
I'm using drizzle. When writing a transaction with drizzle you have to use the transaction that you get from the callback (usually named
tx
), but I was using the main db
instance in the transaction and that's why they didn't match up.foreign-sapphire•5h ago
Haha I've done that before 😀
extended-salmonOP•5h ago
Thanks for the pointer.
I was going crazy 😄
foreign-sapphire•5h ago
Yeah, I need to add this to the docs