Remove deprecated route decorator (#1815)

This commit is contained in:
Elijah Ahianyo 2023-09-14 17:29:29 +00:00 committed by GitHub
parent b378827b83
commit 796f523c03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 46 deletions

View File

@ -37,7 +37,6 @@ from .middleware import Middleware as Middleware
from .model import Model as Model
from .model import session as session
from .page import page as page
from .route import route as route
from .state import ComputedVar as var
from .state import Cookie as Cookie
from .state import LocalStorage as LocalStorage

View File

@ -5,51 +5,6 @@ from __future__ import annotations
import re
from reflex import constants
from reflex.event import EventHandler
from reflex.page import page
from reflex.utils.console import deprecate
def route(
route: str | None = None,
title: str | None = None,
image: str | None = None,
description: str | None = None,
on_load: EventHandler | list[EventHandler] | None = None,
):
"""Decorate a function as a page.
rx.App() will automatically call add_page() for any method decorated with route
when App.compile is called.
All defaults are None because they will use the one from add_page().
Note: the decorated functions still need to be imported.
Args:
route: The route to reach the page.
title: The title of the page.
image: The favicon of the page.
description: The description of the page
on_load: The event handler(s) called when the page load.
Returns:
The decorated function.
"""
deprecate(
feature_name="@rx.route",
deprecation_version="0.2.3",
reason="and is being replaced by @rx.page due to enhanced routing features.",
removal_version="0.2.8",
)
return page(
route=route,
title=title,
image=image,
description=description,
on_load=on_load,
)
def verify_route_validity(route: str) -> None: