CharlesStover / reactn

React, but with built-in global state management.
https://www.npmjs.com/package/reactn
MIT License
1.9k stars 85 forks source link

Unwanted batch rendering #206

Closed gigamesh closed 3 years ago

gigamesh commented 3 years ago

I'm trying to get a spinner to show up when a big table of data is loading from local cache, but the isLoading boolean is only true when the page is reloaded (because it is set to true in the initial state).

How do I get this dispatch to change isLoading and trigger a rerender before it continues with the execution of the reducer?

addReducer('getDashboardData', async (global, dispatch) => {
  dispatch({ isLoading: true });
  ...

I've also tried to await the dispatch, and tried setGlobal({ isLoading: true })