Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`rx.Model` event arguments emit `PydanticDeprecatedSince20` once per payload key

Đang mở Phù hợp với người mới
#7,634 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@fixfon đang làm issue này rồi.

Từ ngày 22/10/2026.

  • #7636 của @fixfon — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, testing

Hướng nghiên cứu

Bắt đầu tại packages/reflex-base/src/reflex_base/event/processor/base_state_processor.py:141 và đọc _transform_event_arg, sau đó chạy trường hợp tái hiện trong issue để xác nhận các cảnh báo. Dùng các khóa trường của model một lần khi lọc payload. Hoàn tất khi cùng phép biến đổi đó không phát ra cảnh báo PydanticDeprecatedSince20.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug
An event handler argument can have an rx.Model type hint. When the payload is a dict, _transform_event_arg removes the keys that are not model fields. It checks each key with hinted_args.__fields__. Pydantic v2 deprecates __fields__, so each key emits one PydanticDeprecatedSince20 warning, on every event.

Code: packages/reflex-base/src/reflex_base/event/processor/base_state_processor.py:141

if key in hinted_args.__fields__

To Reproduce

import warnings

import reflex as rx
from reflex_base.event.processor.base_state_processor import _transform_event_arg


class Tbl(rx.Model, table=True):
    name: str


with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    _transform_event_arg({"name": "a", "extra": 1, "other": 2}, Tbl)

for w in caught:
    print(w.category.__name__, w.filename.split("src/")[-1], w.lineno)

Output on main (7f89e48c3):

PydanticDeprecatedSince20 reflex_base/event/processor/base_state_processor.py 141
PydanticDeprecatedSince20 reflex_base/event/processor/base_state_processor.py 141
PydanticDeprecatedSince20 reflex_base/event/processor/base_state_processor.py 141

Expected behavior
No deprecation warning. rx.Model is a SQLModel, which is Pydantic v2, so hinted_args.model_fields gives the same keys. Read it once, not once per key.

rx.Model is deprecated, so this only matters until it is removed. The fix is one line.

Specifics

  • Python 3.14.6, pydantic 2.13.5, reflex main (7f89e48c3)
  • Related: #7561 and #7592 fix the same warning in reflex_base/utils/types.py.
Ngôn ngữ chính
Python
Star
29k
Fork
1.8k
Merge trung bình
3 ngày 7 giờ
Pull request đã merge (30 ngày)
181

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của reflex-dev/reflex

Tất cả issue của reflex-dev/reflex

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.