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

Way more diff data transfered over the wire when using Surface component than plain LV even if rendered html is very similar

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
elixir
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start with the SurfaceBulma.Button implementation linked at lib/surface_bulma/button.ex#L97 and compare its rendered output with the plain LiveView templates in the report. Reproduce the favorite? toggle on the stated Surface and LiveView versions, inspect the rendering and diff path, and consider the issue done when equivalent component HTML no longer sends substantially more diff data.

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

Mô tả

Describe the bug

Can't tell if this is a bug, more likely a flaw or technical debt, but I hope it's not the intended behavior.

Altering a SurfaceBulma.Button disabled attribute (only) produces way too much data and I don't think this has anything to do with the component itself, but rather the rendering engine.

Please note that in both cases (Surface and plain LiveView) the provided code is part of a component in a prepended list of such components, thus only the changed component is sent in each case.

1. Plain LiveView

Template code

<button phx-click="add_favorite" disabled={@card.favorite?} size="large" phx-target={@myself}>Add to Favorites</button>
<button phx-click="remove_favorite" disabled={[email protected]?} size="large" phx-target={@myself}>Remove from favorites</button>

Rendered html

<button phx-click="add_favorite" size="large" phx-target="1">Add to Favorites</button>
<button phx-click="remove_favorite" size="large" phx-target="1" disabled="">Remove from favorites</button>

Diffs when @card.favorite? toggles:

{
  "2": {
    "5": {
      "d": [
        [
          2
        ]
      ]
    },
    "8": "3"
  },
  "c": {
    "2": {
      "4": " disabled",
      "7": ""
    }
  }
}
2. SurfaceBulma.Button

Template code:

<Button click="add_favorite" disabled={@card.favorite?} size="large">Add to Favorites</Button>
<Button click="remove_favorite" disabled={[email protected]?} size="large">Remove from favorites</Button>

Rendered html:

<button phx-click="[[&quot;push&quot;,{&quot;event&quot;:&quot;add_favorite&quot;,&quot;target&quot;:1}]]" type="button" class="button is-large">
    Add to Favorites
  </button>
<button phx-click="[[&quot;push&quot;,{&quot;event&quot;:&quot;remove_favorite&quot;,&quot;target&quot;:1}]]" type="button" class="button is-large" disabled="">
    Remove from favorites
  </button>

Diffs when @card.favorite? toggles:

{
  "2": {
    "5": {
      "d": [
        [
          1
        ]
      ]
    },
    "8": "1"
  },
  "c": {
    "1": {
      "3": {
        "0": {
          "0": {
            "0": {
              "0": {
                "0": " phx-click=\"[[&quot;push&quot;,{&quot;event&quot;:&quot;add_favorite&quot;,&quot;target&quot;:1}]]\"",
                "1": "",
                "2": " type=\"button\"",
                "3": "",
                "4": "",
                "5": "",
                "6": " class=\"button is-large\""
              }
            }
          }
        }
      },
      "4": {
        "0": {
          "0": {
            "0": {
              "0": {
                "0": " phx-click=\"[[&quot;push&quot;,{&quot;event&quot;:&quot;remove_favorite&quot;,&quot;target&quot;:1}]]\"",
                "1": "",
                "2": " type=\"button\"",
                "3": "",
                "4": " disabled",
                "5": "",
                "6": " class=\"button is-large\""
              }
            }
          }
        }
      }
    }
  }
}

How to reproduce it

Suffice changing LiveView code to using SurfaceBulma.Button component (or vice-versa).

The behavior you expected

The size of the diffs should be virtually identical, especially given that nothing except for disabled changes and the rendered html code has the same number of elements in both cases i.e. 1 per button.

Your Environment

Surface: v0.7.4
LiveView: v0.17.9
Elixir: v1.13.4

Ngôn ngữ chính
Elixir
Star
2.1k
Fork
146
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 surface-ui/surface

Tất cả issue của surface-ui/surface

Issue tương tự

Thêm issue về Elixir

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.