Skip to content

setState should clearly error within useAsync #176

@PitchforkAssistant

Description

@PitchforkAssistant

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions