remove hack and pass proper const for position

This commit is contained in:
Lendemor 2024-12-13 01:36:19 +01:00
parent daa1f0cb52
commit 444e970809
3 changed files with 3 additions and 4 deletions

View File

@ -5,7 +5,7 @@ export function {{tag_name}} () {
{{ hook }}
{% endfor %}
{% for hook, data in component._get_all_hooks().items() if not data.position or data.position == positions.PRE_TRIGGER %}
{% for hook, data in component._get_all_hooks().items() if not data.position or data.position == hook_positions.PRE_TRIGGER %}
{{ hook }}
{% endfor %}
@ -13,7 +13,7 @@ export function {{tag_name}} () {
{{ hook }}
{% endfor %}
{% for hook,data in component._get_all_hooks().items() if data.position and data.position == positions.POST_TRIGGER %}
{% for hook,data in component._get_all_hooks().items() if data.position and data.position == hook_positions.POST_TRIGGER %}
{{ hook }}
{% endfor %}

View File

@ -45,6 +45,7 @@ class ReflexJinjaEnvironment(Environment):
"on_load_internal": constants.CompileVars.ON_LOAD_INTERNAL,
"update_vars_internal": constants.CompileVars.UPDATE_VARS_INTERNAL,
"frontend_exception_state": constants.CompileVars.FRONTEND_EXCEPTION_STATE_FULL,
"hook_positions": constants.Hooks.HookPosition,
}

View File

@ -24,7 +24,6 @@ from typing import (
)
import reflex.state
from reflex import constants
from reflex.base import Base
from reflex.compiler.templates import STATEFUL_COMPONENT
from reflex.components.core.breakpoints import Breakpoints
@ -2169,7 +2168,6 @@ class StatefulComponent(BaseComponent):
tag_name=tag_name,
memo_trigger_hooks=memo_trigger_hooks,
component=component,
positions=constants.Hooks.HookPosition,
)
@staticmethod