Waiters composition
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, react
- 領域
- frontend
調査の方向性
まず useWait API と createWaitingContext を読み、次に issue で説明されている Waiter provider アプローチを調べます。合成された waiter が子の状態をどのように伝播するか、また手動の start/end がサポートされるかを定義します。API の動作とエッジケースが仕様化され、既存の waiter の動作に照らして検証されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 305
- フォーク
- 28
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
f/react-wait のほかの issue
-
delta オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
f/react-wait#15 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
f/react-wait#14 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
f/react-wait#13 · コメント 5 件 · リアクション 5 件 ·
-
Add withWait() HOC オープン
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
f/react-wait#8 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
f/react-wait#7 · コメント 1 件 ·
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
antfu-collective/icones#398 ·
-
ECmail.com オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
wesbos/burner-email-providers#554 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
components-web-app/docs#92 ·