Merge branch 'main' into maintenance/version_bump

This commit is contained in:
Lendemor 2024-11-18 21:00:10 +01:00
commit 0b42f0b20a
4 changed files with 17 additions and 10 deletions

View File

@ -50,7 +50,7 @@ jobs:
- run: poetry run uv pip install pyvirtualdisplay pillow pytest-split - run: poetry run uv pip install pyvirtualdisplay pillow pytest-split
- name: Run app harness tests - name: Run app harness tests
env: env:
SCREENSHOT_DIR: /tmp/screenshots SCREENSHOT_DIR: /tmp/screenshots/${{ matrix.state_manager }}/${{ matrix.python-version }}/${{ matrix.split_index }}
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }} REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: | run: |
poetry run playwright install --with-deps poetry run playwright install --with-deps

8
poetry.lock generated
View File

@ -2542,13 +2542,13 @@ SQLAlchemy = ">=2.0.14,<2.1.0"
[[package]] [[package]]
name = "starlette" name = "starlette"
version = "0.41.2" version = "0.41.3"
description = "The little ASGI library that shines." description = "The little ASGI library that shines."
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8"
files = [ files = [
{file = "starlette-0.41.2-py3-none-any.whl", hash = "sha256:fbc189474b4731cf30fcef52f18a8d070e3f3b46c6a04c97579e85e6ffca942d"}, {file = "starlette-0.41.3-py3-none-any.whl", hash = "sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7"},
{file = "starlette-0.41.2.tar.gz", hash = "sha256:9834fd799d1a87fd346deb76158668cfa0b0d56f85caefe8268e2d97c3468b62"}, {file = "starlette-0.41.3.tar.gz", hash = "sha256:0e4ab3d16522a255be6b28260b938eae2482f98ce5cc934cb08dce8dc3ba5835"},
] ]
[package.dependencies] [package.dependencies]
@ -3033,4 +3033,4 @@ type = ["pytest-mypy"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.9" python-versions = "^3.9"
content-hash = "cbd3aec9a795dcb26019fd4bc7f9ef31194054858ba55bfe1467f65c3dbaaf1a" content-hash = "99d5de7cfecc9293f052d5e84a3c37d7ba93acf5cfb1f83b3ba203826fa0781d"

View File

@ -59,6 +59,7 @@ twine = ">=4.0.0,<6.0"
tomlkit = ">=0.12.4,<1.0" tomlkit = ">=0.12.4,<1.0"
lazy_loader = ">=0.4" lazy_loader = ">=0.4"
reflex-chakra = ">=0.6.0" reflex-chakra = ">=0.6.0"
typing_extensions = ">=4.6.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pytest = ">=7.1.2,<9.0" pytest = ">=7.1.2,<9.0"

View File

@ -1904,6 +1904,11 @@ memo = custom_component
class NoSSRComponent(Component): class NoSSRComponent(Component):
"""A dynamic component that is not rendered on the server.""" """A dynamic component that is not rendered on the server."""
def _get_import_name(self) -> None | str:
if not self.library:
return None
return f"${self.library}" if self.library.startswith("/") else self.library
def _get_imports(self) -> ParsedImportDict: def _get_imports(self) -> ParsedImportDict:
"""Get the imports for the component. """Get the imports for the component.
@ -1917,8 +1922,9 @@ class NoSSRComponent(Component):
_imports = super()._get_imports() _imports = super()._get_imports()
# Do NOT import the main library/tag statically. # Do NOT import the main library/tag statically.
if self.library is not None: import_name = self._get_import_name()
_imports[self.library] = [ if import_name is not None:
_imports[import_name] = [
imports.ImportVar( imports.ImportVar(
tag=None, tag=None,
render=False, render=False,
@ -1936,10 +1942,10 @@ class NoSSRComponent(Component):
opts_fragment = ", { ssr: false });" opts_fragment = ", { ssr: false });"
# extract the correct import name from library name # extract the correct import name from library name
if self.library is None: base_import_name = self._get_import_name()
if base_import_name is None:
raise ValueError("Undefined library for NoSSRComponent") raise ValueError("Undefined library for NoSSRComponent")
import_name = format.format_library_name(base_import_name)
import_name = format.format_library_name(self.library)
library_import = f"const {self.alias if self.alias else self.tag} = dynamic(() => import('{import_name}')" library_import = f"const {self.alias if self.alias else self.tag} = dynamic(() => import('{import_name}')"
mod_import = ( mod_import = (