Skip to content

Commit d162d7e

Browse files
committed
Merge branch 'main' into khaleel/eng-7266-since-v08-redirects-from-on_load-and-on_mount-handlers-are
2 parents 9bceafb + 82d24b7 commit d162d7e

File tree

25 files changed

+1782
-1763
lines changed

25 files changed

+1782
-1763
lines changed

pyi_hashes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"reflex/components/el/elements/tables.pyi": "e3f299e59bb8ff87aa949c6b606551c9",
4141
"reflex/components/el/elements/typography.pyi": "b4ec4ffb448f7a9b5f94712404448d9e",
4242
"reflex/components/gridjs/datatable.pyi": "98a7e1b3f3b60cafcdfcd8879750ee42",
43-
"reflex/components/lucide/icon.pyi": "eb7929c0d708ddbbe8ed4849cd4aa5ce",
43+
"reflex/components/lucide/icon.pyi": "020db5c37c5a6bee5912532a89d6deda",
4444
"reflex/components/markdown/markdown.pyi": "2f84254a548e908020949564fc289339",
4545
"reflex/components/moment/moment.pyi": "93fa4c6009390fe9400197ab52735b84",
4646
"reflex/components/plotly/plotly.pyi": "4311a0aae2abcc9226abb6a273f96372",

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "reflex"
3-
version = "0.8.6dev1"
3+
version = "0.8.7dev1"
44
description = "Web apps in pure Python."
55
license.text = "Apache-2.0"
66
authors = [
@@ -32,7 +32,7 @@ dependencies = [
3232
"python-multipart >=0.0.20,<1.0",
3333
"python-socketio >=5.12.0,<6.0",
3434
"redis >=5.2.1,<7.0",
35-
"reflex-hosting-cli >=0.1.53",
35+
"reflex-hosting-cli >=0.1.54",
3636
"rich >=13,<15",
3737
"sqlmodel >=0.0.24,<0.1",
3838
"starlette >=0.47.0",
@@ -233,7 +233,7 @@ fail_fast = true
233233

234234
[[tool.pre-commit.repos]]
235235
repo = "https://github.com/astral-sh/ruff-pre-commit"
236-
rev = "v0.12.7"
236+
rev = "v0.12.8"
237237
hooks = [
238238
{ id = "ruff-format", args = [
239239
"reflex",

reflex/.templates/jinja/web/vite.config.js.jinja2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export default defineConfig((config) => ({
4646
},
4747
},
4848
},
49+
experimental: {
50+
enableNativePlugin: false,
51+
},
4952
server: {
5053
port: process.env.PORT,
5154
watch: {

reflex/app.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
console,
110110
exceptions,
111111
format,
112+
frontend_skeleton,
113+
js_runtimes,
112114
path_ops,
113115
prerequisites,
114116
types,
@@ -598,10 +600,6 @@ def __call__(self) -> ASGIApp:
598600
"""
599601
from reflex.vars.base import GLOBAL_CACHE
600602

601-
# For py3.9 compatibility when redis is used, we MUST add any decorator pages
602-
# before compiling the app in a thread to avoid event loop error (REF-2172).
603-
self._apply_decorated_pages()
604-
605603
self._compile(prerender_routes=is_prod_mode())
606604

607605
config = get_config()
@@ -992,7 +990,7 @@ def _get_frontend_packages(self, imports: dict[str, set[ImportVar]]):
992990
continue
993991
_frontend_packages.append(package)
994992
page_imports.update(_frontend_packages)
995-
prerequisites.install_frontend_packages(page_imports, get_config())
993+
js_runtimes.install_frontend_packages(page_imports, get_config())
996994

997995
def _app_root(self, app_wrappers: dict[tuple[int, str], Component]) -> Component:
998996
for component in tuple(app_wrappers.values()):
@@ -1065,16 +1063,8 @@ def memoized_badge():
10651063
self.app_wraps[(0, "StickyBadge")] = lambda _: memoized_badge()
10661064

10671065
def _apply_decorated_pages(self):
1068-
"""Add @rx.page decorated pages to the app.
1069-
1070-
This has to be done in the MainThread for py38 and py39 compatibility, so the
1071-
decorated pages are added to the app before the app is compiled (in a thread)
1072-
to workaround REF-2172.
1073-
1074-
This can move back into `compile_` when py39 support is dropped.
1075-
"""
1066+
"""Add @rx.page decorated pages to the app."""
10761067
app_name = get_config().app_name
1077-
# Add the @rx.page decorated pages to collect on_load events.
10781068
for render, kwargs in DECORATED_PAGES[app_name]:
10791069
self.add_page(render, **kwargs)
10801070

@@ -1124,6 +1114,8 @@ def _compile(self, prerender_routes: bool = False, dry_run: bool = False):
11241114
"""
11251115
from reflex.utils.exceptions import ReflexRuntimeError
11261116

1117+
self._apply_decorated_pages()
1118+
11271119
self._pages = {}
11281120

11291121
def get_compilation_time() -> str:
@@ -1440,7 +1432,7 @@ def _submit_work_without_advancing(
14401432
self._get_frontend_packages(all_imports)
14411433

14421434
# Setup the react-router.config.js
1443-
prerequisites.update_react_router_config(
1435+
frontend_skeleton.update_react_router_config(
14441436
prerender_routes=prerender_routes,
14451437
)
14461438

reflex/components/lucide/icon.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from reflex.vars.base import LiteralVar, Var
77
from reflex.vars.sequence import LiteralStringVar, StringVar
88

9-
LUCIDE_LIBRARY = "lucide-react@0.536.0"
9+
LUCIDE_LIBRARY = "lucide-react@0.539.0"
1010

1111

1212
class LucideIconComponent(Component):
@@ -343,6 +343,7 @@ def _get_imports(self):
343343
"brain_cog",
344344
"brain",
345345
"brick_wall_fire",
346+
"brick_wall_shield",
346347
"brick_wall",
347348
"briefcase_business",
348349
"briefcase_conveyor_belt",
@@ -494,6 +495,7 @@ def _get_imports(self):
494495
"circle_slash_2",
495496
"circle_slash",
496497
"circle_small",
498+
"circle_star",
497499
"circle_stop",
498500
"circle_user_round",
499501
"circle_user",
@@ -950,6 +952,7 @@ def _get_imports(self):
950952
"japanese_yen",
951953
"joystick",
952954
"kanban",
955+
"kayak",
953956
"key_round",
954957
"key_square",
955958
"key",

reflex/components/plotly/plotly.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Plotly(NoSSRComponent):
7272

7373
library = "[email protected]"
7474

75-
lib_dependencies: list[str] = ["plotly.js@3.0.3"]
75+
lib_dependencies: list[str] = ["plotly.js@3.1.0"]
7676

7777
tag = "Plot"
7878

@@ -303,7 +303,7 @@ class PlotlyBasic(Plotly):
303303

304304
library = "[email protected]"
305305

306-
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.0.3"]
306+
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.0"]
307307

308308
def add_imports(self) -> ImportDict | list[ImportDict]:
309309
"""Add imports for the plotly basic component.
@@ -329,7 +329,7 @@ class PlotlyCartesian(Plotly):
329329

330330
library = "[email protected]"
331331

332-
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.0.3"]
332+
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.0"]
333333

334334
def add_imports(self) -> ImportDict | list[ImportDict]:
335335
"""Add imports for the plotly cartesian component.
@@ -355,7 +355,7 @@ class PlotlyGeo(Plotly):
355355

356356
library = "[email protected]"
357357

358-
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.0.3"]
358+
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.0"]
359359

360360
def add_imports(self) -> ImportDict | list[ImportDict]:
361361
"""Add imports for the plotly geo component.
@@ -381,7 +381,7 @@ class PlotlyGl3d(Plotly):
381381

382382
library = "[email protected]"
383383

384-
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.0.3"]
384+
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.0"]
385385

386386
def add_imports(self) -> ImportDict | list[ImportDict]:
387387
"""Add imports for the plotly 3d component.
@@ -407,7 +407,7 @@ class PlotlyGl2d(Plotly):
407407

408408
library = "[email protected]"
409409

410-
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.0.3"]
410+
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.0"]
411411

412412
def add_imports(self) -> ImportDict | list[ImportDict]:
413413
"""Add imports for the plotly 2d component.
@@ -433,7 +433,7 @@ class PlotlyMapbox(Plotly):
433433

434434
library = "[email protected]"
435435

436-
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.0.3"]
436+
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.0"]
437437

438438
def add_imports(self) -> ImportDict | list[ImportDict]:
439439
"""Add imports for the plotly mapbox component.
@@ -459,7 +459,7 @@ class PlotlyFinance(Plotly):
459459

460460
library = "[email protected]"
461461

462-
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.0.3"]
462+
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.0"]
463463

464464
def add_imports(self) -> ImportDict | list[ImportDict]:
465465
"""Add imports for the plotly finance component.
@@ -485,7 +485,7 @@ class PlotlyStrict(Plotly):
485485

486486
library = "[email protected]"
487487

488-
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.0.3"]
488+
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.0"]
489489

490490
def add_imports(self) -> ImportDict | list[ImportDict]:
491491
"""Add imports for the plotly strict component.

reflex/components/recharts/recharts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Recharts(Component):
99
"""A component that wraps a recharts lib."""
1010

11-
library = "[email protected].0"
11+
library = "[email protected].2"
1212

1313
def _get_style(self) -> dict:
1414
return {"wrapperStyle": self.style}
@@ -17,7 +17,7 @@ def _get_style(self) -> dict:
1717
class RechartsCharts(NoSSRComponent, MemoizationLeaf):
1818
"""A component that wraps a recharts lib."""
1919

20-
library = "[email protected].0"
20+
library = "[email protected].2"
2121

2222

2323
LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]

reflex/constants/installer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Bun(SimpleNamespace):
1414
"""Bun constants."""
1515

1616
# The Bun version.
17-
VERSION = "1.2.19"
17+
VERSION = "1.2.20"
1818

1919
# Min Bun Version
2020
MIN_VERSION = "1.2.17"
@@ -75,7 +75,7 @@ class Node(SimpleNamespace):
7575

7676

7777
def _determine_react_router_version() -> str:
78-
default_version = "7.7.1"
78+
default_version = "7.8.0"
7979
if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
8080
from reflex.utils import console
8181

@@ -143,11 +143,11 @@ def DEPENDENCIES(cls) -> dict[str, str]:
143143
"postcss-import": "16.1.1",
144144
"@react-router/dev": _react_router_version,
145145
"@react-router/fs-routes": _react_router_version,
146-
"vite": "npm:rolldown-vite@7.0.12",
146+
"vite": "npm:rolldown-vite@7.1.2",
147147
}
148148
OVERRIDES = {
149149
# This should always match the `react` version in DEPENDENCIES for recharts compatibility.
150150
"react-is": _react_version,
151151
"cookie": "1.0.2",
152-
"vite": "npm:rolldown-vite@7.0.12",
152+
"vite": "npm:rolldown-vite@7.1.2",
153153
}

reflex/custom_components/custom_components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from reflex import constants
1717
from reflex.constants import CustomComponents
18-
from reflex.utils import console
18+
from reflex.utils import console, frontend_skeleton
1919

2020

2121
def set_loglevel(ctx: Any, self: Any, value: str | None):
@@ -328,7 +328,7 @@ def init(
328328
Raises:
329329
Exit: If the pyproject.toml already exists.
330330
"""
331-
from reflex.utils import exec, prerequisites
331+
from reflex.utils import exec
332332

333333
if CustomComponents.PYPROJECT_TOML.exists():
334334
console.error(f"A {CustomComponents.PYPROJECT_TOML} already exists. Aborting.")
@@ -347,7 +347,7 @@ def init(
347347
_populate_demo_app(name_variants)
348348

349349
# Initialize the .gitignore.
350-
prerequisites.initialize_gitignore(
350+
frontend_skeleton.initialize_gitignore(
351351
gitignore_file=CustomComponents.FILE, files_to_ignore=CustomComponents.DEFAULTS
352352
)
353353

reflex/reflex.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _init(
5858
ai: bool = False,
5959
):
6060
"""Initialize a new Reflex app in the given directory."""
61-
from reflex.utils import exec, prerequisites
61+
from reflex.utils import exec, frontend_skeleton, prerequisites, templates
6262

6363
# Show system info
6464
exec.output_system_info()
@@ -80,13 +80,13 @@ def _init(
8080
prerequisites.initialize_frontend_dependencies()
8181

8282
# Initialize the app.
83-
template = prerequisites.initialize_app(app_name, template)
83+
template = templates.initialize_app(app_name, template)
8484

8585
# Initialize the .gitignore.
86-
prerequisites.initialize_gitignore()
86+
frontend_skeleton.initialize_gitignore()
8787

8888
# Initialize the requirements.txt.
89-
needs_user_manual_update = prerequisites.initialize_requirements_txt()
89+
needs_user_manual_update = frontend_skeleton.initialize_requirements_txt()
9090

9191
template_msg = f" using the {template} template" if template else ""
9292
# Finish initializing the app.
@@ -371,7 +371,7 @@ def compile(dry: bool):
371371
_init(name=get_config().app_name)
372372
get_config(reload=True)
373373
starting_time = time.monotonic()
374-
prerequisites.compile_app(dry_run=dry)
374+
prerequisites.get_compiled_app(dry_run=dry)
375375
elapsed_time = time.monotonic() - starting_time
376376
console.success(f"App compiled successfully in {elapsed_time:.3f} seconds.")
377377

@@ -737,9 +737,10 @@ def deploy(
737737
def rename(new_name: str):
738738
"""Rename the app in the current directory."""
739739
from reflex.utils import prerequisites
740+
from reflex.utils.rename import rename_app
740741

741742
prerequisites.validate_app_name(new_name)
742-
prerequisites.rename_app(new_name, get_config().loglevel)
743+
rename_app(new_name, get_config().loglevel)
743744

744745

745746
if TYPE_CHECKING:

0 commit comments

Comments
 (0)