react-stack / redux-storage

Persistence layer for redux with flexible backends
MIT License
222 stars 18 forks source link

loading screen while save operations happen #1

Closed jrmcdona closed 7 years ago

jrmcdona commented 7 years ago

Hello-

I am trying to figure out how to know when all of my Save operations have completed, so I can move to the next screen.

Right now we have about 5 save operations on start up.

Best practice for knowing when those have completed?

Thanks!

guns2410 commented 7 years ago

you could use load(store) to achieve this

load(store)
    .then((newState) => this.setState({ loading: false })) // set your state or flag here
    .catch(() => console.log('Failed to load previous state'));

usually this could be in componentDidMount