Remove cross-DB menu_nodes query from non-blog apps
menu_nodes table lives in db_blog. Non-blog apps (cart, market, events, account, federation) were querying it on their own DB session, causing UndefinedTableError. The nav-tree fragment from blog provides the real navigation; menu_items is now an empty fallback list. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,6 @@ from bp import register_account_bp, register_auth_bp, register_fragments
|
||||
async def account_context() -> dict:
|
||||
"""Account app context processor."""
|
||||
from shared.infrastructure.context import base_context
|
||||
from shared.services.navigation import get_navigation_tree
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.infrastructure.fragments import fetch_fragments
|
||||
from shared.infrastructure.data_client import fetch_data
|
||||
@@ -21,8 +20,8 @@ async def account_context() -> dict:
|
||||
|
||||
ctx = await base_context()
|
||||
|
||||
# Fallback for _nav.html when nav-tree fragment fetch fails
|
||||
ctx["menu_items"] = await get_navigation_tree(g.s)
|
||||
# menu_nodes lives in db_blog; nav-tree fragment provides the real nav
|
||||
ctx["menu_items"] = []
|
||||
|
||||
# Cart data via internal data endpoint
|
||||
ident = current_cart_identity()
|
||||
|
||||
@@ -54,14 +54,13 @@ async def cart_context() -> dict:
|
||||
Global cart_count / cart_total stay global for cart-mini.
|
||||
"""
|
||||
from shared.infrastructure.context import base_context
|
||||
from shared.services.navigation import get_navigation_tree
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.infrastructure.fragments import fetch_fragments
|
||||
|
||||
ctx = await base_context()
|
||||
|
||||
# Fallback for _nav.html when nav-tree fragment fetch fails
|
||||
ctx["menu_items"] = await get_navigation_tree(g.s)
|
||||
# menu_nodes lives in db_blog; nav-tree fragment provides the real nav
|
||||
ctx["menu_items"] = []
|
||||
|
||||
# Pre-fetch cross-app HTML fragments concurrently
|
||||
user = getattr(g, "user", None)
|
||||
|
||||
@@ -19,7 +19,6 @@ async def events_context() -> dict:
|
||||
- cart_count/cart_total: via cart service (shared DB)
|
||||
"""
|
||||
from shared.infrastructure.context import base_context
|
||||
from shared.services.navigation import get_navigation_tree
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.infrastructure.fragments import fetch_fragments
|
||||
from shared.infrastructure.data_client import fetch_data
|
||||
@@ -27,8 +26,8 @@ async def events_context() -> dict:
|
||||
|
||||
ctx = await base_context()
|
||||
|
||||
# Fallback for _nav.html when nav-tree fragment fetch fails
|
||||
ctx["menu_items"] = await get_navigation_tree(g.s)
|
||||
# menu_nodes lives in db_blog; nav-tree fragment provides the real nav
|
||||
ctx["menu_items"] = []
|
||||
|
||||
# Cart data via internal data endpoint
|
||||
ident = current_cart_identity()
|
||||
|
||||
@@ -18,7 +18,6 @@ from bp import (
|
||||
async def federation_context() -> dict:
|
||||
"""Federation app context processor."""
|
||||
from shared.infrastructure.context import base_context
|
||||
from shared.services.navigation import get_navigation_tree
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.infrastructure.fragments import fetch_fragments
|
||||
from shared.infrastructure.data_client import fetch_data
|
||||
@@ -26,8 +25,8 @@ async def federation_context() -> dict:
|
||||
|
||||
ctx = await base_context()
|
||||
|
||||
# Fallback for _nav.html when nav-tree fragment fetch fails
|
||||
ctx["menu_items"] = await get_navigation_tree(g.s)
|
||||
# menu_nodes lives in db_blog; nav-tree fragment provides the real nav
|
||||
ctx["menu_items"] = []
|
||||
|
||||
# Cart data via internal data endpoint
|
||||
ident = current_cart_identity()
|
||||
|
||||
@@ -22,7 +22,6 @@ async def market_context() -> dict:
|
||||
- cart: direct ORM query (templates need .product relationship)
|
||||
"""
|
||||
from shared.infrastructure.context import base_context
|
||||
from shared.services.navigation import get_navigation_tree
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.infrastructure.fragments import fetch_fragments
|
||||
from shared.infrastructure.data_client import fetch_data
|
||||
@@ -32,8 +31,8 @@ async def market_context() -> dict:
|
||||
|
||||
ctx = await base_context()
|
||||
|
||||
# Fallback for _nav.html when nav-tree fragment fetch fails
|
||||
ctx["menu_items"] = await get_navigation_tree(g.s)
|
||||
# menu_nodes lives in db_blog; nav-tree fragment provides the real nav
|
||||
ctx["menu_items"] = []
|
||||
|
||||
ident = current_cart_identity()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user