Skip to content

error when var is given something not a str#5164

Merged
adhami3310 merged 1 commit intomainfrom
error-when-var-is-given-something-not-a-str
Apr 23, 2025
Merged

error when var is given something not a str#5164
adhami3310 merged 1 commit intomainfrom
error-when-var-is-given-something-not-a-str

Conversation

@adhami3310
Copy link
Copy Markdown
Member

No description provided.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 23, 2025

CodSpeed Performance Report

Merging #5164 will not alter performance

Comparing error-when-var-is-given-something-not-a-str (6a02134) with main (3bcf01d)

Summary

✅ 12 untouched benchmarks

@Lendemor
Copy link
Copy Markdown
Contributor

With

class Foo(rx.Base):
    field: str | rx.Var[str]    

the following expression:
Foo(field=["1", "bar"]).field

will still give

Var(_js_expr="1", _var_type="bar", _var_data=None)

instead of raising an error because a list was passed.

@adhami3310
Copy link
Copy Markdown
Member Author

instead of raising an error because a list was passed.

that seems an issue on pydantic and not Var

@Lendemor
Copy link
Copy Markdown
Contributor

instead of raising an error because a list was passed.

that seems an issue on pydantic and not Var

yeah, I just left that comment so we keep a trace of this issue

@adhami3310 adhami3310 merged commit a420b17 into main Apr 23, 2025
42 checks passed
@adhami3310 adhami3310 deleted the error-when-var-is-given-something-not-a-str branch April 23, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants