Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Disabling queries via ReactFireOptions

Aperta
#346 1 commento 8 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
firebase, react, typescript
Ambito
frontend

Direzione di ricerca

La issue indica ReactFireOptions e ObservableStatus come punti di ingresso rilevanti; inizia tracciando il modo in cui gli hook di ReactFire eseguono le query ed espongono lo stato. Confronta il comportamento enabled proposto con lo stato alternativo exists, inclusa la gestione di initialData. Il lavoro è completato quando le query dipendenti possono evitare un’esecuzione non intenzionale oppure determinare in modo affidabile l’esistenza di un riferimento senza trattare i dati segnaposto come un risultato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

v5

I've read the discussion in #178 and am yet another person that has run into the wall of "can't use the hooks with a not-yet-defined id". I understand and agree with your desire to keep undefined/null ids as errors. But we still run into situations where the use of react-fire hooks constrains our design decisions and requires us to make several small components that issue the same query when one query would do and would allow us to present the UI in a single component as we wish.

I suggest adopting something similar to how react-query handles this. Passing in an enabled flag to the ReactFireOptions object which would prevent the query from executing if enabled === false (and instead returning initialData, if defined). This would allow the errors to persist when inadvertently passing in undefined/null, but also allow consumers to make their own design decisions when constructing dependent queries.

Alternatively, add an exists property to the ObservableStatus so that we can determine, without an additional query, whether the ref already exists. Currently when I have a dependent query I pass in an ID that I know not to exist, e.g. "-1", but I get back a document that has a firestore-generated ID and nothing else. Without the ability to disable the query or determine if the ref exists I rely on the object being otherwise empty to determine if I should return an undefined or not.

Lingua principale
TypeScript
Stelle
3.6k
Fork
403
Merge medio
5g 1h
PR unite (30g)
10

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FirebaseExtended/reactfire

Tutte le issue di FirebaseExtended/reactfire

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.