Keyword arguments are not supported for Events

Đang mở
#6,495 2 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 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Start by locating reflex_base.event.EventCallback.call and the typing used for event callbacks. Reproduce the supplied MyState.do_something example with Python 3.14 and type checking enabled; done means the keyword argument tries is accepted without a type error.

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

Mô tả

Describe the bug
When yielding a server event with a keyword argument from a server event, the type checker complains with:

Unexpected keyword argument `tries` in function `reflex_base.event.EventCallback.__call__`

To Reproduce
Just paste the code below into your code editor with type checking enabled and note the underlined keyword as shown in the screen shot.

  • Code:
import reflex as rx


class MyState(rx.State):
    @rx.event
    def do_something(self, tries=1):
        # yield something to client
        if tries > 0:
            yield MyState.do_something(tries=tries - 1)

Expected behavior
There should not be any type check errors

Screenshots

Image

Specifics:

  • Python Version: 3.14
  • Reflex Version: 0.9.2
  • OS: Ubuntu
Ngôn ngữ chính
Python
Star
29k
Fork
1.8k
Merge trung bình
3 ngày 5 giờ
Pull request đã merge (30 ngày)
182

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.