solidjs / solidjs/solid-docs

[Content]: misleading section about when derived-signals are called

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

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

solid
Ngôn ngữ chính
MDX
Star
292
Fork
361
Merge trung bình
7 giờ 51 phút
Pull request đã merge (30 ngày)
1

Mô tả

📚 Subject area/topic

concepts/derived-values/derived-signals

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/concepts/derived-values/derived-signals

📋 Description of content that is out-of-date or incorrect

These functions are not executed immediately, but instead are only called when the values they rely on are changed. When the underlying signal is changed, the function will be called again to produce a new value.

I'm beginning with solidjs, so maybe I got this wrong, but I think this is at least misleading.

It is not called when count() changed (click "call inc").
It is only called, if it is explicitly called (in the example click "call double") or if it is used in a reactive context (uncomment {/*<div>double: {double()}</div>*/})

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
import { render } from "solid-js/web";
import { createSignal } from "solid-js";

function App() {
    const [count, setCount] = createSignal(0);

    const inc = () => setCount(count() + 1)
    const double = () => {console.log("double called"); return count() * 2}

    return (
        <div>
            <div>count: {count()}</div>
            {/*<div>double: {double()}</div>*/}
            <button onClick={() => inc()}>call inc</button>
            <button onClick={() => double()}>call double</button>
        </div>
    );
}

render(() => <App />, document.getElementById('app'));

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 với trang tài liệu về derived-signals được liên kết trong issue và so sánh phần giải thích được trích dẫn với bản tái hiện SolidJS được cung cấp. Cập nhật cách diễn đạt để mô tả chính xác thời điểm hàm chạy, sau đó xác minh ví dụ và hành vi do đó tạo ra trong tài liệ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ệ
javascript
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
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.