We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 956b75e commit 4c1636fCopy full SHA for 4c1636f
reflex/app.py
@@ -491,11 +491,19 @@ def add_page(
491
"""
492
# If the route is not set, get it from the callable.
493
if route is None:
494
- assert isinstance(
495
- component, Callable
496
- ), "Route must be set if component is not a callable."
497
- # Format the route.
498
- route = format.format_route(component.__name__)
+ match component:
+ case Callable():
+ # Format the route.
+ route = format.format_route(
+ route=component.__name__,
499
+ )
500
+
501
+ case _:
502
+ error_msg: str = "Route must be set if component is not a callable."
503
+ raise TypeError(
504
+ error_msg,
505
506
507
else:
508
route = format.format_route(route, format_case=False)
509
0 commit comments