@@ -38,16 +38,15 @@ def route(path: str, element: Any | None, *routes: Route) -> Route:
3838def create_router (compiler : RouteCompiler [R ]) -> Router [R ]:
3939 """A decorator that turns a route compiler into a router"""
4040
41- def wrapper (* routes : R , select : Literal [ "first" , "all" ] = "first" ) -> ComponentType :
42- return router_component (* routes , select = select , compiler = compiler )
41+ def wrapper (* routes : R ) -> ComponentType :
42+ return router (* routes , compiler = compiler )
4343
4444 return wrapper
4545
4646
4747@component
48- def router_component (
48+ def router (
4949 * routes : R ,
50- select : Literal ["first" , "all" ],
5150 compiler : RouteCompiler [R ],
5251) -> VdomDict | None :
5352 """A component that renders matching route(s) using the given compiler function."""
@@ -60,7 +59,7 @@ def router_component(
6059 dependencies = (compiler , hash (routes )),
6160 )
6261
63- match = use_memo (lambda : _match_route (resolvers , location , select ))
62+ match = use_memo (lambda : _match_route (resolvers , location , select = "first" ))
6463
6564 if match :
6665 route_elements = [
@@ -86,8 +85,8 @@ def link(*children: VdomChild, to: str, **attributes: Any) -> VdomDict:
8685 """A component that renders a link to the given path.
8786
8887 FIXME: This currently works in a "dumb" way by trusting that ReactPy's script tag
89- properly sets the location. When a client-server communication layer is added to
90- ReactPy, this component will need to be rewritten to use that instead."""
88+ properly sets the location. When a client-server communication layer is added to a
89+ future ReactPy release , this component will need to be rewritten to use that instead."""
9190 set_location = _use_route_state ().set_location
9291 uuid = uuid4 ().hex
9392
0 commit comments