loading property returned by useFetchPosts isn't entirely accurate
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- next.js, react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia individuando useFetchPosts e confronta il suo calcolo dello stato di caricamento con il valore isLoading restituito da useFetch. Poi esamina il componente RelatedPosts in wp-nextjs-app per capire come gestisce lo stato di caricamento, i dati e NotFoundError. Il lavoro è completato quando lo stato di caricamento termina correttamente se non vengono trovati dati, senza compromettere il comportamento esistente del componente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your enhancement related to a problem? Please describe.
When there is no data to return from useFetchPosts and a NotFoundError is returned instead, the loading property is still set to true.
For components that are relying on this property to display some sort of loading state, this can mean that they display that loading state indefinitely. An example of this can be seen in the RelatedPosts component of wp-nextjs-app.
https://share.zight.com/v1uq5KWZ
useFetch returns an accurate isLoading property to useFetchPosts, however, useFetchPosts does not use this and instead generates its own loading property. Components like RelatedPosts will then assume that if useFetchPosts isn't loading, it must have data. However, there is also the possibility that it is done loading and just has not found any data.
I'm not sure if we can change this behavior without breaking things since there may be components that are built with this existing behavior in mind, but it would be nice to be able to know if something is done loading, even if it doesn't return results.
Designs
No response
Describe alternatives you've considered
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- TypeScript
- Stelle
- 204
- Fork
- 26
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 10up/headstartwp
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
10up/headstartwp#950 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
10up/headstartwp#948 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
10up/headstartwp#902 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
10up/headstartwp#900 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
10up/headstartwp#857 ·
Tutte le issue di 10up/headstartwp
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 87/100
I maintainer di solito rispondono entro 1 giorno
-
🛠️ dette technique
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
betagouv/mon-entreprise#4752 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
franciscoBSalgueiro/en-croissant#1111 ·
I maintainer di solito rispondono entro 2 giorni
-
area/providers type/feature version/v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anomalyco/opencode#64845 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno