Skip to content

Commit 465d53a

Browse files
committed
Merge remote-tracking branch 'origin/main' into khaleel/eng-7266-since-v08-redirects-from-on_load-and-on_mount-handlers-are
2 parents d162d7e + 8c20566 commit 465d53a

File tree

16 files changed

+42
-140
lines changed

16 files changed

+42
-140
lines changed

pyi_hashes.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"reflex/components/core/__init__.pyi": "007170b97e58bdf28b2aee381d91c0c7",
1515
"reflex/components/core/auto_scroll.pyi": "10c4cf71d0d0c1d46a8e1205bd119c11",
1616
"reflex/components/core/banner.pyi": "3c07547afc4f215aefd5e5afa409aa25",
17-
"reflex/components/core/client_side_routing.pyi": "57a7917e993f625c623bcef50b60b804",
1817
"reflex/components/core/clipboard.pyi": "a844eb927d9bc2a43f5e88161b258539",
1918
"reflex/components/core/debounce.pyi": "055da7aa890f44fb4d48bd5978f1a874",
2019
"reflex/components/core/helmet.pyi": "43f8497c8fafe51e29dca1dd535d143a",

reflex/.templates/web/app/routes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { route } from "@react-router/dev/routes";
22
import { flatRoutes } from "@react-router/fs-routes";
33

44
export default [
5-
route("404", "routes/[404]._index.jsx", { id: "404" }),
65
...(await flatRoutes({
76
ignoredRouteFiles: ["routes/\\[404\\]._index.jsx"],
87
})),

reflex/.templates/web/utils/client_side_routing.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

reflex/app.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@
6767
connection_toaster,
6868
)
6969
from reflex.components.core.breakpoints import set_breakpoints
70-
from reflex.components.core.client_side_routing import (
71-
default_404_page,
72-
wait_for_client_redirect,
73-
)
7470
from reflex.components.core.sticky import sticky
7571
from reflex.components.core.upload import Upload, get_upload_dir
7672
from reflex.components.radix import themes
@@ -775,8 +771,10 @@ def add_page(
775771

776772
if route == constants.Page404.SLUG:
777773
if component is None:
778-
component = default_404_page
779-
component = wait_for_client_redirect(self._generate_component(component))
774+
from reflex.components.el.elements import span
775+
776+
component = span("404: Page not found")
777+
component = self._generate_component(component)
780778
title = title or constants.Page404.TITLE
781779
description = description or constants.Page404.DESCRIPTION
782780
image = image or constants.Page404.IMAGE
@@ -1312,7 +1310,9 @@ def memoized_toast_provider():
13121310
self.head_components,
13131311
html_lang=self.html_lang,
13141312
html_custom_attrs=(
1315-
{**self.html_custom_attrs} if self.html_custom_attrs else {}
1313+
{"suppressHydrationWarning": "true", **self.html_custom_attrs}
1314+
if self.html_custom_attrs
1315+
else {"suppressHydrationWarning": "true"}
13161316
),
13171317
)
13181318
)

reflex/components/component.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
PageNames,
3838
)
3939
from reflex.constants.compiler import SpecialAttributes
40-
from reflex.constants.state import FRONTEND_EVENT_STATE
40+
from reflex.constants.state import FRONTEND_EVENT_STATE, MEMO_MARKER
4141
from reflex.event import (
4242
EventCallback,
4343
EventChain,
@@ -2005,7 +2005,7 @@ def get_args_spec(key: str) -> types.ArgsSpec | Sequence[types.ArgsSpec]:
20052005

20062006
super()._post_init(
20072007
event_triggers={
2008-
key: EventChain.create(
2008+
key + MEMO_MARKER: EventChain.create(
20092009
value=props[key],
20102010
args_spec=get_args_spec(key),
20112011
key=key,
@@ -2016,7 +2016,9 @@ def get_args_spec(key: str) -> types.ArgsSpec | Sequence[types.ArgsSpec]:
20162016
)
20172017

20182018
to_camel_cased_props = {
2019-
format.to_camel_case(key) for key in props if key not in event_types
2019+
format.to_camel_case(key + MEMO_MARKER)
2020+
for key in props
2021+
if key not in event_types
20202022
}
20212023
self.get_props = lambda: to_camel_cased_props # pyright: ignore [reportIncompatibleVariableOverride]
20222024

@@ -2031,7 +2033,7 @@ def get_args_spec(key: str) -> types.ArgsSpec | Sequence[types.ArgsSpec]:
20312033
if key not in props_types:
20322034
continue
20332035

2034-
camel_cased_key = format.to_camel_case(key)
2036+
camel_cased_key = format.to_camel_case(key + MEMO_MARKER)
20352037

20362038
# Get the type based on the annotation.
20372039
type_ = props_types[key]

reflex/components/core/client_side_routing.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

reflex/config.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ class BaseConfig:
254254
# List of fully qualified import paths of plugins to disable in the app (e.g. reflex.plugins.sitemap.SitemapPlugin).
255255
disable_plugins: list[str] = dataclasses.field(default_factory=list)
256256

257+
# Whether to skip plugin checks.
258+
_skip_plugins_checks: bool = dataclasses.field(default=False, repr=False)
259+
257260
_prefixes: ClassVar[list[str]] = ["REFLEX_"]
258261

259262

@@ -284,6 +287,9 @@ class Config(BaseConfig):
284287
See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
285288
"""
286289

290+
# Track whether the app name has already been validated for this Config instance.
291+
_app_name_is_valid: bool = dataclasses.field(default=False, repr=False)
292+
287293
def _post_init(self, **kwargs):
288294
"""Post-initialization method to set up the config.
289295
@@ -315,7 +321,8 @@ def _post_init(self, **kwargs):
315321
setattr(self, key, env_value)
316322

317323
# Add builtin plugins if not disabled.
318-
self._add_builtin_plugins()
324+
if not self._skip_plugins_checks:
325+
self._add_builtin_plugins()
319326

320327
# Update default URLs if ports were set
321328
kwargs.update(env_kwargs)
@@ -531,7 +538,7 @@ def _get_config() -> Config:
531538
if not spec:
532539
# we need this condition to ensure that a ModuleNotFound error is not thrown when
533540
# running unit/integration tests or during `reflex init`.
534-
return Config(app_name="")
541+
return Config(app_name="", _skip_plugins_checks=True)
535542
rxconfig = importlib.import_module(constants.Config.MODULE)
536543
return rxconfig.config
537544

reflex/constants/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ class ReactRouter(Javascript):
174174
rf"(?:{DEV_FRONTEND_LISTENING_REGEX}|{PROD_FRONTEND_LISTENING_REGEX})(.*)"
175175
)
176176

177+
SPA_FALLBACK = "__spa-fallback.html"
178+
177179

178180
# Color mode variables
179181
class ColorMode(SimpleNamespace):

reflex/constants/installer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Commands(SimpleNamespace):
106106

107107
DEV = "react-router dev --host"
108108
EXPORT = "react-router build"
109-
PROD = "serve ./build/client"
109+
PROD = "sirv ./build/client --single 404.html --host"
110110

111111
PATH = "package.json"
112112

@@ -127,7 +127,7 @@ def DEPENDENCIES(cls) -> dict[str, str]:
127127
"react-router": cls._react_router_version,
128128
"react-router-dom": cls._react_router_version,
129129
"@react-router/node": cls._react_router_version,
130-
"serve": "14.2.4",
130+
"sirv-cli": "3.0.1",
131131
"react": cls._react_version,
132132
"react-helmet": "6.1.0",
133133
"react-dom": cls._react_version,

reflex/constants/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ class StateManagerMode(str, Enum):
1515
FRONTEND_EVENT_STATE = "__reflex_internal_frontend_event_state"
1616

1717
FIELD_MARKER = "_rx_state_"
18+
MEMO_MARKER = "_rx_memo_"

0 commit comments

Comments
 (0)