T
TanStack•7h ago
extended-salmon

`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.
No description
10 Replies
extended-salmon
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-salmon
extended-salmonOP•6h ago
No description
extended-salmon
extended-salmonOP•6h ago
And this is the error:
No description
extended-salmon
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
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-salmon
extended-salmonOP•5h ago
I wonder why that would happen?
No description
extended-salmon
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
foreign-sapphire•5h ago
Haha I've done that before 😀
extended-salmon
extended-salmonOP•5h ago
Thanks for the pointer. I was going crazy 😄
foreign-sapphire
foreign-sapphire•5h ago
Yeah, I need to add this to the docs

Did you find this page helpful?