Update rx.get_upload_url signature to accept Var[str] (#4826)

* Update rx.get_upload_url signature to accept Var[str]

* Add py.typed

Fix #4806
This commit is contained in:
Masen Furer 2025-02-14 17:10:01 -08:00 committed by GitHub
parent 10bae9577c
commit 6848915883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -147,7 +147,7 @@ uploaded_files_url_prefix = Var(
).to(str)
def get_upload_url(file_path: str) -> Var[str]:
def get_upload_url(file_path: str | Var[str]) -> Var[str]:
"""Get the URL of an uploaded file.
Args:
@ -158,7 +158,7 @@ def get_upload_url(file_path: str) -> Var[str]:
"""
Upload.is_used = True
return uploaded_files_url_prefix + "/" + file_path
return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
def _on_drop_spec(files: Var) -> Tuple[Var[Any]]:

View File

@ -35,7 +35,7 @@ uploaded_files_url_prefix = Var(
),
).to(str)
def get_upload_url(file_path: str) -> Var[str]: ...
def get_upload_url(file_path: str | Var[str]) -> Var[str]: ...
class UploadFilesProvider(Component):
@overload

0
reflex/py.typed Normal file
View File