plotly / plotly/dash

aio components custom attributes not passed down

Đang mở
#2,004 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

bug P3
Ngôn ngữ chính
Python
Star
24.4k
Fork
2.3k
Merge trung bình
2 ngày 7 giờ
Pull request đã merge (30 ngày)
13

Mô tả

Describe your context

dash                      2.3.1
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-labs                 1.0.3
dash-table                5.0.0

Following six line demonstrator works with static layout:

 app.layout = layout()

but fails to initialise when invoked dynamically:

  app.layout = layout

The issue is with the method simple_clone(), in dash.py/L566. The Dash layout clone method
fails to pass in the value total_items=100. This is significant problem since the sub-classing the
standard Dash components is used extensively when implementing the reusable components
AIO pattern.

class MyDiv(html.Div):
    def __init__(self, children=None, className='some-class', total_items=None, page_size=10):

        # Fails with TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
        pages = total_items / page_size

        print(pages)
        super().__init__(pages, className=className)

def layout():
    return MyDiv(total_items=100)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu trong dash.py quanh L566 và kiểm tra simple_clone() bằng ví dụ MyDiv được cung cấp. So sánh layout() tĩnh với layout động và xác minh rằng thuộc tính tùy chỉnh total_items=100 được giữ lại để layout động khởi tạo mà không gặp TypeError đã nêu.

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

Đánh giá

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

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.