Fix handler execution: inject page helpers into handler env
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
component-source and handler-source are page helpers, not IO primitives. They need to be in the handler evaluation env just like defpage evaluation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,7 @@ async def execute_handler(
|
|||||||
4. Return ``SxExpr`` wire format
|
4. Return ``SxExpr`` wire format
|
||||||
"""
|
"""
|
||||||
from .jinja_bridge import get_component_env, _get_request_context
|
from .jinja_bridge import get_component_env, _get_request_context
|
||||||
|
from .pages import get_page_helpers
|
||||||
import os
|
import os
|
||||||
if os.environ.get("SX_USE_REF") == "1":
|
if os.environ.get("SX_USE_REF") == "1":
|
||||||
from .ref.async_eval_ref import async_eval_to_sx
|
from .ref.async_eval_ref import async_eval_to_sx
|
||||||
@@ -139,6 +140,7 @@ async def execute_handler(
|
|||||||
|
|
||||||
# Build environment
|
# Build environment
|
||||||
env = dict(get_component_env())
|
env = dict(get_component_env())
|
||||||
|
env.update(get_page_helpers(service_name))
|
||||||
env.update(handler_def.closure)
|
env.update(handler_def.closure)
|
||||||
|
|
||||||
# Bind handler params from request args
|
# Bind handler params from request args
|
||||||
|
|||||||
Reference in New Issue
Block a user