I answered my own question I'm pretty sure. I need to SubscribeToAction and then load the rest of the data once that has been called. Below is some code that in my actual app where I'm waiting on UserSetUserResponseAction to be called then loading the rest of the component data. I need the CurrentUser to be able to finish the component data, so if it is not Initialized yet, then load the user data by dispatching the UserLoadUserResponseAction, else just use the UserStore.Value.CurrentUser.
I'd like to be able to just use UserStore.Value.CurrentUser instead of using another property that I'm setting, from the action.UserResponse, but the UserSetUserResponseAction callback is called before the reducer is which sets it, so UserStore.Value.CurrentUser is not yet set, when the rest of the code is run.
In the WeatherStore, you'll notice that the LoadForecasts EffectMethod dispatches the WeatherLoadForecastsSuccessAction to indicate that the forecasts have been loaded. If I want to have some action happen after the forecasts have been loaded, I can SubscribeToAction<WeatherLoadForecastsSuccessAction> and put whatever I need to do in there.
It looks like that's what you're doing with the SubscribeToAction<UserSetUserResponseAction> so I think we're on the same page there.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I answered my own question I'm pretty sure. I need to SubscribeToAction and then load the rest of the data once that has been called. Below is some code that in my actual app where I'm waiting on UserSetUserResponseAction to be called then loading the rest of the component data. I need the CurrentUser to be able to finish the component data, so if it is not Initialized yet, then load the user data by dispatching the UserLoadUserResponseAction, else just use the UserStore.Value.CurrentUser.
I'd like to be able to just use UserStore.Value.CurrentUser instead of using another property that I'm setting, from the action.UserResponse, but the UserSetUserResponseAction callback is called before the reducer is which sets it, so UserStore.Value.CurrentUser is not yet set, when the rest of the code is run.
In the WeatherStore, you'll notice that the
LoadForecasts
EffectMethod dispatches theWeatherLoadForecastsSuccessAction
to indicate that the forecasts have been loaded. If I want to have some action happen after the forecasts have been loaded, I canSubscribeToAction<WeatherLoadForecastsSuccessAction>
and put whatever I need to do in there.It looks like that's what you're doing with the
SubscribeToAction<UserSetUserResponseAction>
so I think we're on the same page there.