Deprecate @rx.dynamic
Merged
FA
1d ago+115+115+012345678901234567890123456789-20-20-01234567890123456789
All Submissions:
- Have you followed the guidelines stated in CONTRIBUTING.md file?
- Have you checked to ensure there aren't any other open Pull Requests for the desired changed?
Type of change
- Deprecation (non-breaking:
@rx.dynamickeeps working and now warns)
Changes To Core Features:
- Have you added an explanation of what your changes do and why you'd like us to include them?
- Have you written new tests for your core changes, as applicable?
- Have you successfully ran tests with your changes locally?
Description
Deprecates the @rx.dynamic decorator; it will be removed in 1.0. Only the decorator is deprecated here; the rest of the dynamic-component machinery is left alone and can be removed together with it.
- Runtime: applying the decorator calls
console.deprecate, so the warning points at the user's decorated definition:@rx.dynamic has been deprecated. It will be completely removed in 1.0. (app/page.py:12) console.deprecate()(reflex-base):reasonanddeprecation_versionare now optional; an empty one is left out of the message. Existing callers pass both, so their messages are unchanged. Covered bytest_deprecate_omits_empty_reason_and_version.- Type level: a
typing_extensions.deprecatedstub insideTYPE_CHECKING, following the_load_configpattern inreflex_base/config.py. Checked that pyright reportsrx.dynamicas deprecated through therx.namespace. - Test:
test_dynamic_is_deprecatedintests/units/test_state.pychecks the full warning and its source location. It failed before the change. The existing_wrapped_handler_warningshelper is renamed_deprecation_warningsso it can be reused. - News:
news/+deprecate-rx-dynamic.deprecation.mdandpackages/reflex-base/news/+deprecate-optional-reason-version.feature.md.
examples/playground still uses @rx.dynamic and will log the warning until the decorator is removed.
Testing
uv run ruff check .,uv run ruff format --check .anduv run pyright reflex testsare clean.uv run pytest tests/units: the only failures are 264 tests (reflex_cli/v2cloud API andreflex_benchbrowser drivers) that need network or browser access the sandbox doesn't have. They fail identically on the base commit.
https://claude.ai/code/session_01LwJUCT1HV3LAGGnxS82EWr
Generated by Claude Code