Bug Fixes
- A column of a SQLAlchemy
DeclarativeBasemodel whose column type gives no useful Python type, such asJSON,JSONBorPickleType, now has the type of itsMapped[...]annotation when read through a state var, sodata: Mapped[dict] = mapped_column(JSON)supportsState.model.data["key"], and aMapped[list[str]]JSON column supportsrx.foreachand array operations, without.to(dict). An annotation that refines the column's Python type, such asMapped[dict[str, int]]overdict, is used too; otherwise the column type still decides. (#7798) - Operations on an optional list var (
list[T] | None) holdingNoneno longer crash the page or the production prerender: the list acts as an empty list, socontainsis false,lengthis 0 andjoingives an empty string. As with any empty list,reducewithout aninitialvalue still raises; passinitial=when the list can beNone. (#7800) - A computed var that returns an optional list, tuple, set or frozenset (for example
-> set[str] | None) now reads asArrayVarorSetVarfor type checkers instead ofComputedVar, so its operations type-check. (#7800) - Deprecation warnings now point at the app line that triggered them when the deprecated call runs inside a
reflex_components_*package (for exampleon_change=client_state.set_value), instead of a file insite-packages. (#7811)
Performance
- The first event of a handler that takes a
dict, dataclass,TypedDictor Pydantic model argument no longer imports SQLAlchemy on the event loop. (#7802)