Skip to content

Commit c60147b

Browse files
veerababu1729masenfgreptile-apps[bot]
authored
feat: list valid triggers in error message for invalid event triggers (#6015)
* feat: list valid triggers in error message for invalid event triggers * Update reflex/components/component.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Masen Furer <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent a78f358 commit c60147b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

reflex/components/component.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,11 @@ def _post_init(self, *args, **kwargs):
758758
and key not in component_specific_triggers
759759
and key not in props
760760
):
761+
valid_triggers = sorted(component_specific_triggers.keys())
761762
msg = (
762-
f"The {(comp_name := type(self).__name__)} does not take in an `{key}` event trigger. If {comp_name}"
763-
f" is a third party component make sure to add `{key}` to the component's event triggers. "
763+
f"The {(comp_name := type(self).__name__)} does not take in an `{key}` event trigger. "
764+
f"Valid triggers for {comp_name}: {valid_triggers}. "
765+
f"If {comp_name} is a third party component make sure to add `{key}` to the component's event triggers. "
764766
f"visit https://reflex.dev/docs/wrapping-react/guide/#event-triggers for more info."
765767
)
766768
raise ValueError(msg)

0 commit comments

Comments
 (0)