setState not working after async await

Open
#124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

The report names no file or test; start by reproducing the useState/setState flow with an await between updates and inspect the relevant frontend entry point. Done means the expected state update after the async gap is reproducible, its cause is identified, and the behavior is covered by a regression check.

Written by the indexing model from the issue text.

Description

blocks
Details

I have a [state, setState] couple from useState.

setState works fine in the first call, but after an 'await someAsyncFunction' it doesn't work anymore.

I know flutter warns of using context across async gaps, so this may be similar

Additional info

Discord message: _I have a [state, setState] couple from useState.

setState works fine in the first call, but after an 'await someAsyncFunction' it doesn't work anymore.

I know flutter warns of using context across async gaps, so this may be similar_

Message author: odedbendov

Discord link: https://discord.com/channels/1050224141732687912/1311724352160665661/1311724352160665661

Dominant language
TypeScript
Stars
210
Forks
88
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reddit/devvit

All issues in reddit/devvit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.