浏览代码

restore get_decorated_pages behavior and deprecate it (#5194)

Khaleel Al-Adhami 2 周之前
父节点
当前提交
e79503e5e1
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 0 1
      reflex/app.py
  2. 8 0
      reflex/page.py

+ 0 - 1
reflex/app.py

@@ -1117,7 +1117,6 @@ class App(MiddlewareMixin, LifespanMixin):
         # Add the @rx.page decorated pages to collect on_load events.
         for render, kwargs in DECORATED_PAGES[app_name]:
             self.add_page(render, **kwargs)
-        DECORATED_PAGES[app_name].clear()
 
     def _validate_var_dependencies(self, state: type[BaseState] | None = None) -> None:
         """Validate the dependencies of the vars in the app.

+ 8 - 0
reflex/page.py

@@ -8,6 +8,7 @@ from typing import Any
 
 from reflex.config import get_config
 from reflex.event import EventType
+from reflex.utils import console
 
 DECORATED_PAGES: dict[str, list] = defaultdict(list)
 
@@ -76,6 +77,13 @@ def get_decorated_pages(omit_implicit_routes: bool = True) -> list[dict[str, Any
     Returns:
         The decorated pages.
     """
+    console.deprecate(
+        "get_decorated_pages",
+        reason="This function is deprecated and will be removed in a future version.",
+        deprecation_version="0.7.9",
+        removal_version="0.8.0",
+        dedupe=True,
+    )
     return sorted(
         [
             page_data