setState should clearly error within useAsync

Aperta
#176 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Start by locating the useAsync entry point and reviewing the documentation that currently warns about state use inside data-fetch functions. Trace how setState calls are handled there and identify the existing tests for useAsync behavior. Done means an in-scope setState call produces a clear error rather than being silently ignored, with the documentation updated if needed.

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

Descrizione

blocks

It appears that set state calls inside of useAsync data fetch functions are silently ignored.

Issues with using state inside of the useAsync function are mentioned in the docs, but it is clearly not visible enough, as many devs have unknowingly ran into this issue.

I think the best solution would be to throw an error if a set state function is called in useAsync.

Reddit thread regarding this: https://www.reddit.com/r/Devvit/comments/1jrjtp6/blocks_psa_dont_use_setstate_within_useasync/

Lingua principale
TypeScript
Stelle
210
Fork
88
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

  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 reddit/devvit

Tutte le issue di reddit/devvit

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.