[Bug]:Possible wrong descrption for useDeferredValue
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 11.8k
- Fork
- 7.9k
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
Summary
The doucmention describe the wrong behaviour for useDeferredValue
Page
https://react.dev/reference/react/Suspense
Details
The documentation says:
The query will update immediately, so the input will display the new value. However, the deferredQuery will keep its previous value until the data has loaded
From my test, deferredQuery also updates immediately rather than waiting for the data to be loaded here is the link https://codesandbox.io/p/sandbox/react-dev-forked-kxfktt
useDeferredValue consistently lags query with around 4 or 5 ms
Think about it, if deferredQuery updates after SearchResults is ready, how SearchResults receive the latest data at the first place?
The real reason we can see opacity: 0.2 for several seconds is that the new content is not rendered yet; rather than
the deferredQuery will keep its previous value until the data has loaded
If my understanding is correct, I should say the documentation is misleading, especially for the newbies
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Đọc phần nói về useDeferredValue trên https://react.dev/reference/react/Suspense và tái hiện hành vi trong CodeSandbox được liên kết. So sánh cách diễn đạt về deferredQuery với thời điểm quan sát được, sau đó cập nhật tài liệu để giải thích chính xác khi nào giá trị thay đổi và độ mờ biểu thị điều gì.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react
- 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
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100