From f0f6566489c07d391058dfd85578294e1d8b8355 Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 18 Nov 2024 13:38:20 +0000 Subject: [PATCH] Unify `is_external` prop in `rx.redirect` and `rx.link` --- reflex/event.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/reflex/event.py b/reflex/event.py index 312c9887f..7ad5ea9c3 100644 --- a/reflex/event.py +++ b/reflex/event.py @@ -705,6 +705,7 @@ def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec: def redirect( path: str | Var[str], external: Optional[bool] = False, + is_external: Optional[bool] = False, replace: Optional[bool] = False, ) -> EventSpec: """Redirect to a new path. @@ -712,16 +713,26 @@ def redirect( Args: path: The path to redirect to. external: Whether to open in new tab or not. + is_external: Whether to open in new tab or not. replace: If True, the current page will not create a new history entry. Returns: An event to redirect to the path. """ + if external: + console.deprecate( + "The `external` prop in `rx.redirect`", + "use `is_external` instead.", + "0.6.6", + "0.7.0", + ) + is_external = external + return server_side( "_redirect", get_fn_signature(redirect), path=path, - external=external, + external=is_external, replace=replace, )