Commit transaction before fetching cart-mini fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s
The cart-mini fragment is fetched via HTTP from the cart app, which uses its own DB connection. Without committing first, the cart app sees stale data (no new item). Commit the transaction, start a new one so after_request can still commit cleanly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -254,6 +254,10 @@ def register():
|
||||
|
||||
# htmx response: OOB-swap mini cart + product buttons
|
||||
if request.headers.get("HX-Request") == "true":
|
||||
# Commit so the cart app sees the updated data when we fetch the fragment
|
||||
await g.tx.commit()
|
||||
g.tx = await g.s.begin()
|
||||
|
||||
from shared.infrastructure.fragments import fetch_fragment
|
||||
from shared.infrastructure.cart_identity import current_cart_identity as _ci
|
||||
frag_ident = _ci()
|
||||
|
||||
Reference in New Issue
Block a user