reflex 0.8.4a1__py3-none-any.whl → 0.8.4a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

@@ -18,17 +18,9 @@ const ThemeContext = createContext({
18
18
 
19
19
  export function ThemeProvider({ children, defaultTheme = "system" }) {
20
20
  const [theme, setTheme] = useState(defaultTheme);
21
-
22
- // Detect system preference synchronously during initialization
23
- const getInitialSystemTheme = () => {
24
- if (defaultTheme !== "system") return defaultTheme;
25
- if (typeof window === "undefined") return "light";
26
- return window.matchMedia("(prefers-color-scheme: dark)").matches
27
- ? "dark"
28
- : "light";
29
- };
30
-
31
- const [systemTheme, setSystemTheme] = useState(getInitialSystemTheme);
21
+ const [systemTheme, setSystemTheme] = useState(
22
+ defaultTheme !== "system" ? defaultTheme : "light",
23
+ );
32
24
  const [isInitialized, setIsInitialized] = useState(false);
33
25
 
34
26
  const firstRender = useRef(true);
@@ -45,6 +37,7 @@ export function ThemeProvider({ children, defaultTheme = "system" }) {
45
37
  if (lastCompiledTheme !== defaultColorMode) {
46
38
  // on app startup, make sure the application color mode is persisted correctly.
47
39
  localStorage.setItem("last_compiled_theme", defaultColorMode);
40
+ setIsInitialized(true);
48
41
  return;
49
42
  }
50
43
  }
@@ -78,19 +71,21 @@ export function ThemeProvider({ children, defaultTheme = "system" }) {
78
71
  };
79
72
  });
80
73
 
81
- // Save theme to localStorage whenever it changes (but not on initial mount)
74
+ // Save theme to localStorage whenever it changes
75
+ // Skip saving only if theme key already exists and we haven't initialized yet
82
76
  useEffect(() => {
83
- if (isInitialized) {
84
- localStorage.setItem("theme", theme);
85
- }
86
- }, [theme, isInitialized]);
77
+ const existingTheme = localStorage.getItem("theme");
78
+ if (!isInitialized && existingTheme !== null) return;
79
+ localStorage.setItem("theme", theme);
80
+ }, [theme]);
87
81
 
88
82
  useEffect(() => {
83
+ if (!isInitialized) return;
89
84
  const root = window.document.documentElement;
90
85
  root.classList.remove("light", "dark");
91
86
  root.classList.add(resolvedTheme);
92
87
  root.style.colorScheme = resolvedTheme;
93
- }, [resolvedTheme]);
88
+ }, [resolvedTheme, isInitialized]);
94
89
 
95
90
  return createElement(
96
91
  ThemeContext.Provider,
@@ -143,7 +143,7 @@ class PackageJson(SimpleNamespace):
143
143
  "postcss-import": "16.1.1",
144
144
  "@react-router/dev": _react_router_version,
145
145
  "@react-router/fs-routes": _react_router_version,
146
- "rolldown-vite": "7.0.9",
146
+ "rolldown-vite": "7.0.11",
147
147
  }
148
148
  OVERRIDES = {
149
149
  # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
reflex/utils/misc.py CHANGED
@@ -113,8 +113,6 @@ if (typeof document !== 'undefined') {
113
113
  const systemPreference = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
114
114
  const resolvedTheme = theme === "system" ? systemPreference : theme;
115
115
 
116
- console.log("[PRELOAD] Theme applied:", resolvedTheme, "from theme:", theme, "system:", systemPreference);
117
-
118
116
  // Apply theme immediately - blocks until complete
119
117
  // Use classList to avoid overwriting other classes
120
118
  document.documentElement.classList.remove("light", "dark");
@@ -124,7 +122,6 @@ if (typeof document !== 'undefined') {
124
122
  } catch (e) {
125
123
  // Fallback to system preference on any error (resolve "system" to actual theme)
126
124
  const fallbackTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
127
- console.log("[PRELOAD] Error, falling back to:", fallbackTheme);
128
125
  document.documentElement.classList.remove("light", "dark");
129
126
  document.documentElement.classList.add(fallbackTheme);
130
127
  document.documentElement.style.colorScheme = fallbackTheme;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.8.4a1
3
+ Version: 0.8.4a2
4
4
  Summary: Web apps in pure Python.
5
5
  Project-URL: homepage, https://reflex.dev
6
6
  Project-URL: repository, https://github.com/reflex-dev/reflex
@@ -51,7 +51,7 @@ reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js,sha2
51
51
  reflex/.templates/web/components/shiki/code.js,sha256=4Es1pxsr-lX4hTQ5mglrwwC6O_SI-z-O60k03z8VFzQ,1144
52
52
  reflex/.templates/web/styles/__reflex_style_reset.css,sha256=qbC6JIT643YEsvSQ0D7xBmWE5vXy94JGrKNihRuEjnA,8913
53
53
  reflex/.templates/web/utils/client_side_routing.js,sha256=lRNgEGCLfTejh8W3aCuBdFuko6UI2vetk64j8wLT5Uk,1650
54
- reflex/.templates/web/utils/react-theme.js,sha256=LRnJCHijMMIjDAy-hs7INgJXXGjbyAUD0qm_kFOP-BU,2800
54
+ reflex/.templates/web/utils/react-theme.js,sha256=Aa-RND3ooGCXW6Zavzitc-v0ciKlcQDTFlDtE4mPkFI,2713
55
55
  reflex/.templates/web/utils/state.js,sha256=Z9NeC1sjePtIg03kvxILng-1ri_PNZFAM_t64K4d5Dg,36162
56
56
  reflex/.templates/web/utils/helpers/dataeditor.js,sha256=pG6MgsHuStDR7-qPipzfiK32j9bKDBa-4hZ0JSUo4JM,1623
57
57
  reflex/.templates/web/utils/helpers/debounce.js,sha256=xGhtTRtS_xIcaeqnYVvYJNseLgQVk-DW-eFiHJYO9As,528
@@ -344,7 +344,7 @@ reflex/constants/compiler.py,sha256=VoA1vWZpl-2EdIOhAiOLwSX4S-bFLbkiESlNBmN08NQ,
344
344
  reflex/constants/config.py,sha256=8OIjiBdZZJrRVHsNBheMwopE9AwBFFzau0SXqXKcrPg,1715
345
345
  reflex/constants/custom_components.py,sha256=joJt4CEt1yKy7wsBH6vYo7_QRW0O_fWXrrTf0VY2q14,1317
346
346
  reflex/constants/event.py,sha256=tgoynWQi2L0_Kqc3XhXo7XXL76A-OKhJGHRrNjm7gFw,2885
347
- reflex/constants/installer.py,sha256=VBYFL9BHD0m6cO6RjTQm_PD3JIV63LEl-TtkFJxKkUI,4141
347
+ reflex/constants/installer.py,sha256=i0CUcOCPTGLqNdVEwDxU-UKkaDtEh9ImT5rqmI9Ly90,4142
348
348
  reflex/constants/route.py,sha256=UBjqaAOxiUxlDZCSY4O2JJChKvA4MZrhUU0E5rNvKbM,2682
349
349
  reflex/constants/state.py,sha256=uF_7-M9Gid-P3DjAOq4F1ERplyZhiNccowo_jLrdJrg,323
350
350
  reflex/constants/utils.py,sha256=e1ChEvbHfmE_V2UJvCSUhD_qTVAIhEGPpRJSqdSd6PA,780
@@ -381,7 +381,7 @@ reflex/utils/export.py,sha256=Z2AHuhkxGQzOi9I90BejQ4qEcD0URr2i-ZU5qTJt7eQ,2562
381
381
  reflex/utils/format.py,sha256=FZe5NA0U3K0n0k7r8RIGcx-eHpN7sf8eQX9w1C8_uR8,21120
382
382
  reflex/utils/imports.py,sha256=Ov-lqv-PfsPl3kTEW13r5aDauIfn6TqzEMyv42RKLOA,3761
383
383
  reflex/utils/lazy_loader.py,sha256=BiY9OvmAJDCz10qpuyTYv9duXgMFQa6RXKQmTO9hqKU,4453
384
- reflex/utils/misc.py,sha256=tP_mVuLG38W8-KGwRDm0mJpKjzTYv4oKjPUxkYD5pFU,4781
384
+ reflex/utils/misc.py,sha256=folEweZVCrhHNkkqut9KqQdTJ80HxwL_gI41m40FnNM,4592
385
385
  reflex/utils/net.py,sha256=GXq5KNmYowT-BP4o9HmEqKthm-N9nj82KH8es3EeTWI,4138
386
386
  reflex/utils/path_ops.py,sha256=_RS17IQDNr5vcoLLGZx2-z1E5WP-JgDHvaRAOgqrZiU,8154
387
387
  reflex/utils/prerequisites.py,sha256=8S_Yn3n2ojiqwDkpVmTqbxnTY7ILobFSm4f2MjYXtAw,64129
@@ -401,8 +401,8 @@ reflex/vars/number.py,sha256=tO7pnvFaBsedq1HWT4skytnSqHWMluGEhUbjAUMx8XQ,28190
401
401
  reflex/vars/object.py,sha256=BDmeiwG8v97s_BnR1Egq3NxOKVjv9TfnREB3cz0zZtk,17322
402
402
  reflex/vars/sequence.py,sha256=1kBrqihspyjyQ1XDqFPC8OpVGtZs_EVkOdIKBro5ilA,55249
403
403
  scripts/hatch_build.py,sha256=-4pxcLSFmirmujGpQX9UUxjhIC03tQ_fIQwVbHu9kc0,1861
404
- reflex-0.8.4a1.dist-info/METADATA,sha256=wzr6Xa_YGUJDS051hxGUEVoLq1tWxK6CaYPOMcyPIZw,12372
405
- reflex-0.8.4a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
406
- reflex-0.8.4a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
407
- reflex-0.8.4a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
408
- reflex-0.8.4a1.dist-info/RECORD,,
404
+ reflex-0.8.4a2.dist-info/METADATA,sha256=_LnaAR5A3IOXzH1e1OGVdoU01pS4lupt8zB_-On5pMA,12372
405
+ reflex-0.8.4a2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
406
+ reflex-0.8.4a2.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
407
+ reflex-0.8.4a2.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
408
+ reflex-0.8.4a2.dist-info/RECORD,,