reflex 0.7.14a4__py3-none-any.whl → 0.7.14a6__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.

reflex/app.py CHANGED
@@ -1293,15 +1293,6 @@ class App(MiddlewareMixin, LifespanMixin):
1293
1293
  # Track imports found.
1294
1294
  all_imports = {}
1295
1295
 
1296
- # This has to happen before compiling stateful components as that
1297
- # prevents recursive functions from reaching all components.
1298
- for component in self._pages.values():
1299
- # Add component._get_all_imports() to all_imports.
1300
- all_imports.update(component._get_all_imports())
1301
-
1302
- # Add the app wrappers from this component.
1303
- app_wrappers.update(component._get_all_app_wrap_components())
1304
-
1305
1296
  if (toaster := self.toaster) is not None:
1306
1297
  from reflex.components.component import memo
1307
1298
 
@@ -1319,6 +1310,25 @@ class App(MiddlewareMixin, LifespanMixin):
1319
1310
  if component is not None:
1320
1311
  app_wrappers[key] = component
1321
1312
 
1313
+ # Compile custom components.
1314
+ (
1315
+ custom_components_output,
1316
+ custom_components_result,
1317
+ custom_components_imports,
1318
+ ) = compiler.compile_components(dict.fromkeys(CUSTOM_COMPONENTS.values()))
1319
+ compile_results.append((custom_components_output, custom_components_result))
1320
+ all_imports.update(custom_components_imports)
1321
+ progress.advance(task)
1322
+
1323
+ # This has to happen before compiling stateful components as that
1324
+ # prevents recursive functions from reaching all components.
1325
+ for component in self._pages.values():
1326
+ # Add component._get_all_imports() to all_imports.
1327
+ all_imports.update(component._get_all_imports())
1328
+
1329
+ # Add the app wrappers from this component.
1330
+ app_wrappers.update(component._get_all_app_wrap_components())
1331
+
1322
1332
  if self.error_boundary:
1323
1333
  from reflex.compiler.compiler import into_component
1324
1334
 
@@ -1465,16 +1475,6 @@ class App(MiddlewareMixin, LifespanMixin):
1465
1475
  )
1466
1476
  progress.advance(task)
1467
1477
 
1468
- # Compile custom components.
1469
- (
1470
- custom_components_output,
1471
- custom_components_result,
1472
- custom_components_imports,
1473
- ) = compiler.compile_components(dict.fromkeys(CUSTOM_COMPONENTS.values()))
1474
- compile_results.append((custom_components_output, custom_components_result))
1475
- all_imports.update(custom_components_imports)
1476
-
1477
- progress.advance(task)
1478
1478
  progress.stop()
1479
1479
 
1480
1480
  if dry_run:
@@ -141,17 +141,29 @@ class Bare(Component):
141
141
  custom_code |= component._get_all_custom_code()
142
142
  return custom_code
143
143
 
144
- def _get_all_app_wrap_components(self) -> dict[tuple[int, str], Component]:
144
+ def _get_all_app_wrap_components(
145
+ self, *, ignore_ids: set[int] | None = None
146
+ ) -> dict[tuple[int, str], Component]:
145
147
  """Get the components that should be wrapped in the app.
146
148
 
149
+ Args:
150
+ ignore_ids: The ids to ignore when collecting components.
151
+
147
152
  Returns:
148
153
  The components that should be wrapped in the app.
149
154
  """
150
- app_wrap_components = super()._get_all_app_wrap_components()
155
+ ignore_ids = ignore_ids or set()
156
+ app_wrap_components = super()._get_all_app_wrap_components(
157
+ ignore_ids=ignore_ids
158
+ )
151
159
  if isinstance(self.contents, Var):
152
160
  for component in _components_from_var(self.contents):
153
- if isinstance(component, Component):
154
- app_wrap_components |= component._get_all_app_wrap_components()
161
+ component_id = id(component)
162
+ if isinstance(component, Component) and component_id not in ignore_ids:
163
+ ignore_ids.add(component_id)
164
+ app_wrap_components |= component._get_all_app_wrap_components(
165
+ ignore_ids=ignore_ids
166
+ )
155
167
  return app_wrap_components
156
168
 
157
169
  def _get_all_refs(self) -> set[str]:
@@ -1976,24 +1976,38 @@ class Component(BaseComponent, ABC):
1976
1976
  """
1977
1977
  return {}
1978
1978
 
1979
- def _get_all_app_wrap_components(self) -> dict[tuple[int, str], Component]:
1979
+ def _get_all_app_wrap_components(
1980
+ self, *, ignore_ids: set[int] | None = None
1981
+ ) -> dict[tuple[int, str], Component]:
1980
1982
  """Get the app wrap components for the component and its children.
1981
1983
 
1984
+ Args:
1985
+ ignore_ids: A set of component IDs to ignore. Used to avoid duplicates.
1986
+
1982
1987
  Returns:
1983
1988
  The app wrap components.
1984
1989
  """
1990
+ ignore_ids = ignore_ids or set()
1985
1991
  # Store the components in a set to avoid duplicates.
1986
1992
  components = self._get_app_wrap_components()
1987
1993
 
1988
1994
  for component in tuple(components.values()):
1989
- components.update(component._get_all_app_wrap_components())
1995
+ component_id = id(component)
1996
+ if component_id in ignore_ids:
1997
+ continue
1998
+ ignore_ids.add(component_id)
1999
+ components.update(
2000
+ component._get_all_app_wrap_components(ignore_ids=ignore_ids)
2001
+ )
1990
2002
 
1991
2003
  # Add the app wrap components for the children.
1992
2004
  for child in self.children:
2005
+ child_id = id(child)
1993
2006
  # Skip BaseComponent and StatefulComponent children.
1994
- if not isinstance(child, Component):
2007
+ if not isinstance(child, Component) or child_id in ignore_ids:
1995
2008
  continue
1996
- components.update(child._get_all_app_wrap_components())
2009
+ ignore_ids.add(child_id)
2010
+ components.update(child._get_all_app_wrap_components(ignore_ids=ignore_ids))
1997
2011
 
1998
2012
  # Return the components.
1999
2013
  return components
@@ -2206,13 +2220,23 @@ class CustomComponent(Component):
2206
2220
  component._add_style_recursive(style)
2207
2221
  return component
2208
2222
 
2209
- def _get_all_app_wrap_components(self) -> dict[tuple[int, str], Component]:
2223
+ def _get_all_app_wrap_components(
2224
+ self, *, ignore_ids: set[int] | None = None
2225
+ ) -> dict[tuple[int, str], Component]:
2210
2226
  """Get the app wrap components for the custom component.
2211
2227
 
2228
+ Args:
2229
+ ignore_ids: A set of IDs to ignore to avoid infinite recursion.
2230
+
2212
2231
  Returns:
2213
2232
  The app wrap components.
2214
2233
  """
2215
- return self.get_component()._get_all_app_wrap_components()
2234
+ ignore_ids = ignore_ids or set()
2235
+ component = self.get_component()
2236
+ if id(component) in ignore_ids:
2237
+ return {}
2238
+ ignore_ids.add(id(component))
2239
+ return self.get_component()._get_all_app_wrap_components(ignore_ids=ignore_ids)
2216
2240
 
2217
2241
 
2218
2242
  CUSTOM_COMPONENTS: dict[str, CustomComponent] = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.7.14a4
3
+ Version: 0.7.14a6
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
@@ -2,7 +2,7 @@ reflex/__init__.py,sha256=wMrUAcxHI0Th4EwHIVm9G5zT-zNgO1JX6yWejx0IvvQ,10380
2
2
  reflex/__init__.pyi,sha256=SDnppfexuPej7E5zD2fHKq1gppvvZHBUqqS0tX2Wj-g,11391
3
3
  reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
4
4
  reflex/admin.py,sha256=Nbc38y-M8iaRBvh1W6DQu_D3kEhO8JFvxrog4q2cB_E,434
5
- reflex/app.py,sha256=s6B2kru4D1k4wIOjTL0bBGXIlc6NzcilcOuL-JalJR8,77071
5
+ reflex/app.py,sha256=Mq68jw8kSZRGLUNyTk9aWehBPhHjWmuZ7XX9-dp3Yt0,77071
6
6
  reflex/assets.py,sha256=l5O_mlrTprC0lF7Rc_McOe3a0OtSLnRdNl_PqCpDCBA,3431
7
7
  reflex/base.py,sha256=GYu-PvZ28BVRfnivcAh7s0QiqzxhlDkcugTI4dPMShc,3901
8
8
  reflex/config.py,sha256=S0gEO0vT2GPm2Gof79BT7Qv04dvzq9E-qM1_68lUkVA,19555
@@ -62,7 +62,7 @@ reflex/compiler/templates.py,sha256=SKFIJtL_ozEvEHhiMj34tBwBN1CWSYy_-VzlojZMG44,
62
62
  reflex/compiler/utils.py,sha256=NYvNedrkqoh8i86QL8tOjFZ60JabOM1wBXNkY1ORtiQ,16549
63
63
  reflex/components/__init__.py,sha256=zbIXThv1WPI0FdIGf9G9RAmGoCRoGy7nHcSZ8K5D5bA,624
64
64
  reflex/components/__init__.pyi,sha256=qoj1zIWaitcZOGcJ6k7wuGJk_GAJCE9Xtx8CeRVrvoE,861
65
- reflex/components/component.py,sha256=5bnI90s6EINL8ls_HlcMLaj-t26ABn01P7QEX_sGaIU,99015
65
+ reflex/components/component.py,sha256=reVBK5rshxXictncMa1krjvLdUd_5mtMQYC_esumtzY,99873
66
66
  reflex/components/dynamic.py,sha256=rDPSyoeAWAe7pxA9ZpuamKfBispOrxR-Y2DP8KfwRq8,7404
67
67
  reflex/components/literals.py,sha256=hogLnwTJxFJODIvqihg-GD9kFZVsEBDoYzaRit56Nuk,501
68
68
  reflex/components/props.py,sha256=pte-hBXbwsvB2fS7vYtiyxbHWlWYcDNg8baCfDaOvBE,2699
@@ -70,7 +70,7 @@ reflex/components/base/__init__.py,sha256=QIOxOPT87WrSE4TSHAsZ-358VzvUXAe1w8vWog
70
70
  reflex/components/base/__init__.pyi,sha256=c-8lUF9MAgAo9OHMjKIrV2ScM5S0fg8gTXp3iYFwVKU,1055
71
71
  reflex/components/base/app_wrap.py,sha256=5K_myvYvHPeAJbm3BdEX17tKvdNEj6SV9RYahbIQBAQ,514
72
72
  reflex/components/base/app_wrap.pyi,sha256=-qdsW5SDxROhV11q4TIgnm_1CHx8_AZHHhsnmkdiv18,1915
73
- reflex/components/base/bare.py,sha256=f9e9cW48mjyf7fh6BgsIUV71vSdbK-Xs-SAjngAufg4,7315
73
+ reflex/components/base/bare.py,sha256=jv6HStlixsBTPR6Q_PQnd7MtQDz3ncktcLYUODqwog0,7733
74
74
  reflex/components/base/body.py,sha256=KLPOhxVsKyjPwrY9AziCOOG_c9ckOqIhI4n2i3_Q3NU,129
75
75
  reflex/components/base/body.pyi,sha256=4gWLicS47-WND25iWoj_oOg7i_0oqb36f26vID7NZH8,8665
76
76
  reflex/components/base/document.py,sha256=L5kRdI1bvPQ9dTpHkeG6kqyDvzqZ4uZG4QSj3GMLBuM,551
@@ -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.7.14a4.dist-info/METADATA,sha256=M0L66VwQh_yM3B_9wIjk2D5S5nMBbq7WEKrzzIf5U7Y,11837
405
- reflex-0.7.14a4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
406
- reflex-0.7.14a4.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
407
- reflex-0.7.14a4.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
408
- reflex-0.7.14a4.dist-info/RECORD,,
404
+ reflex-0.7.14a6.dist-info/METADATA,sha256=gyfumI5O81ICNXvRhPnH1qasASk9rRq6RJwrBI5njbc,11837
405
+ reflex-0.7.14a6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
406
+ reflex-0.7.14a6.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
407
+ reflex-0.7.14a6.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
408
+ reflex-0.7.14a6.dist-info/RECORD,,