goatslacker / goatslacker/alt

Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.(…)

Open
#676 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
312
PR merge metrics
No merged PRs in 30d

Description

I'm using [this](http://alt.js.org/docs/async) approach for asyncs in my application but always getting this error:

> Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.(…)

I'm async function like this:

```
if (!this.getInstance().isLoading()) {
this.getInstance().performSearch();
}
```

With setTimeout everything works perfect.

Contributor guide

Open the contributing guide

Research direction

Start with the linked async documentation and the Dispatch.dispatch error, then build a minimal reproduction around the shown performSearch call with and without setTimeout. Done means the async path is understood and the reproduction no longer triggers the dispatch invariant.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.