Waiters composition
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react
- Ambito
- frontend
Direzione di ricerca
Inizia leggendo la useWait API e createWaitingContext, quindi esamina l’approccio del provider Waiter descritto nell’issue. Definisci come i waiter composti propagano lo stato dei figli e se sono supportati start/end manuali; il lavoro è completo quando il comportamento dell’API e i casi limite sono specificati e verificati rispetto al comportamento esistente del waiter.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 305
- Fork
- 28
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di f/react-wait
-
delta Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
f/react-wait#15 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
f/react-wait#14 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
f/react-wait#13 · 5 commenti · 5 reazioni ·
-
Add withWait() HOC Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
f/react-wait#8 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
f/react-wait#7 · 1 commento ·
Tutte le issue di f/react-wait
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
neondatabase/website#5944 ·
-
module: core
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·