You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have an app set up similar to the example app.
The problem we have is the gap between oidcReducer.user is set and storedUser is set in oidcMiddleware.js.
When the oidcReducer.user is populated we will render the App component:
{isLoadingUser || !user || user.expired ? : }
The App component will immediately dispatch three BEGIN_API_CALL actions (for 3 different API calls). This will trigger three LOADING_USER - USER_FOUND action dispatches which (at least in our app) triggers more API calls.
Looking at the code in oidcMiddleware we could solve this by adding "!action.type.startsWith('redux-oidc/')" to the following if statement:
This is kind of related to issue #63
We have an app set up similar to the example app.
The problem we have is the gap between oidcReducer.user is set and storedUser is set in oidcMiddleware.js.
When the oidcReducer.user is populated we will render the App component:
{isLoadingUser || !user || user.expired ? : }
The App component will immediately dispatch three BEGIN_API_CALL actions (for 3 different API calls). This will trigger three LOADING_USER - USER_FOUND action dispatches which (at least in our app) triggers more API calls.
Looking at the code in oidcMiddleware we could solve this by adding "!action.type.startsWith('redux-oidc/')" to the following if statement:
if (
action.type === USER_EXPIRED ||
action.type === LOADING_USER ||
action.type === USER_FOUND ||
!action.type.startsWith('redux-oidc/')
) {
return next(action);
}
I can create a pull request if this seems like a good solution. The other solution could possibly be to set the user when action.type === USER_FOUND?
The text was updated successfully, but these errors were encountered: