- {# Cart mini #}
- {% from '_types/cart/_mini.html' import mini with context %}
- {{mini()}}
+ {# Cart mini — rendered via fragment #}
+ {% if cart_mini_html %}
+ {{ cart_mini_html | safe }}
+ {% endif %}
{# Site title #}
diff --git a/browser/templates/macros/cart_icon.html b/browser/templates/macros/cart_icon.html
new file mode 100644
index 0000000..7b8a958
--- /dev/null
+++ b/browser/templates/macros/cart_icon.html
@@ -0,0 +1,31 @@
+{# Cart icon/badge — shows logo when empty, cart icon with count when items present #}
+
+{% macro cart_icon(count=0, oob=False) %}
+
+{% endmacro %}
diff --git a/browser/templates/macros/layout.html b/browser/templates/macros/layout.html
index 9fe3b57..fc648e8 100644
--- a/browser/templates/macros/layout.html
+++ b/browser/templates/macros/layout.html
@@ -26,7 +26,17 @@
- {% include '_types/blog/mobile/_filter/_hamburger.html' %}
+
- {% import '_types/browse/mobile/_filter/search.html' as s %}
- {{ s.search(current_local_href, search, search_count, hx_select) }}
+ {% from 'macros/search.html' import search_mobile %}
+ {{ search_mobile(current_local_href, search, search_count, hx_select) }}
{%- endmacro %}
diff --git a/browser/templates/macros/search.html b/browser/templates/macros/search.html
new file mode 100644
index 0000000..98c0cde
--- /dev/null
+++ b/browser/templates/macros/search.html
@@ -0,0 +1,83 @@
+{# Shared search input macros for filter UIs #}
+
+{% macro search_mobile(current_local_href, search, search_count, hx_select) -%}
+
+
+
+
+ {% if search %}
+ {{search_count}}
+ {% endif %}
+
+
+{%- endmacro %}
+
+{% macro search_desktop(current_local_href, search, search_count, hx_select) -%}
+
+
+
+
+ {% if search %}
+ {{search_count}}
+ {% endif %}
+ {{zap_filter}}
+
+
+{%- endmacro %}
diff --git a/db/session.py b/db/session.py
index 87fd776..bff449c 100644
--- a/db/session.py
+++ b/db/session.py
@@ -64,11 +64,17 @@ def register_db(app: Quart):
# If an exception occurred OR we didn't commit (still in txn), roll back.
if hasattr(g, "s"):
if exc is not None or g.s.in_transaction():
- if hasattr(g, "tx"):
- await g.tx.rollback()
+ if hasattr(g, "tx") and g.tx.is_active:
+ try:
+ await g.tx.rollback()
+ except Exception:
+ pass
finally:
if hasattr(g, "s"):
- await g.s.close()
+ try:
+ await g.s.close()
+ except Exception:
+ pass
@app.errorhandler(Exception)
async def mark_error(e):