Waiters composition
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu bằng cách đọc useWait API và createWaitingContext, sau đó kiểm tra cách tiếp cận Waiter provider được mô tả trong issue. Xác định cách các waiter được組 hợp truyền trạng thái của các waiter con và liệu start/end thủ công có được hỗ trợ hay không; hoàn thành khi hành vi của API và các trường hợp biên đã được đặc tả và xác minh dựa trên hành vi waiter hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I've been using the library for a while and I noticed that I could simplify my code with something like composing of the waiters. For example, given that I have two waiters bar and baz, I would like to have foo waiter that is waiting if one of bar or baz is waiting.
Motivation
Now, first I was thinking about adding array argument support to isWaiting so that I could call isWaiting(["foo", "bar"]) or a bit more explicit convenience function isAnyWaiting(["foo", "bar"]).
But after looking into my code I realized it's not enough. In my case, I have some big component
Foo rendering smaller components Bar and Baz that wait on each other. That works fine with current API. It gets more convoluted when you would like to have some other component Qux that doesn't exactly want to know about the lower-level ones but needs to know if Foo or any of it's children waits. So currently in Qux you would need to write
const isFooWaiting = isWaiting("baz") && isWaiting("baz")
That's not ideal because Qux needs to know too much about Foo internals.
Proposal
Create a separate method that will create a new waiter if one of the child waiters is waiting. It could be similar in usage to createWaitingContext:
const { compose } = useWait();
const { isWaiting } = compose("Foo", ["Bar", "Baz"])
Foois a waiter, you can check if it's waiting withisWaiting("Foo")Foois always waiting ifBarorBazis waiting.- the open question is should you be able to manually start and end a composed waiter?
Anternative idea
Maybe instead adding a compose method, we could compose Waiter providers? It's just an idea, I don't know if it's possible or makes sense but provier could have an optional name and be a child of another warapper like this?
<Waiter>
<Waiter name="foo">
// ...
</Waiter>
</Waiter>
Then if the inner's anyWaiting() is true, foo is waiting in the outer waiter?
Again, it's just an idea.
- Ngôn ngữ chính
- JavaScript
- Star
- 305
- Fork
- 28
- 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
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. 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
- Đọ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.
Issue khác của f/react-wait
-
deltaĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
f/react-wait#15 ·
-
README.md Proofreading RequestĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
f/react-wait#14 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
f/react-wait#13 · 5 bình luận · 5 reaction ·
-
Add withWait() HOCĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
f/react-wait#8 · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
f/react-wait#7 · 1 bình luận ·
Issue tương tự
-
Complexity: Small P-Feature: Projects page ready for merge team role: back end/devOps role: front end size: 0.25pt
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
bellingcat/toolkit#905 ·
-
self-care self-care:docs-build-time-investigator
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 76/100
githubnext/gh-aw-cao#14191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort:low impact:medium RAG status: auto-triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
mastra-ai/mastra#25229 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sugarlabs/musicblocks#8984 ·
Maintainer thường phản hồi trong vòng 1 ngày