Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify is_external prop in rx.redirect and rx.link #4389

Merged
merged 10 commits into from
Dec 13, 2024
13 changes: 12 additions & 1 deletion reflex/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,23 +705,34 @@ def fn():
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.

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,
)

Expand Down
Loading