ngrx : Action that doesn't change state

Discussão em 'Angular' iniciado por Subashini, Março 31, 2025.

  1. Subashini

    Subashini Guest

    I perform a function(click) in UI which makes API call. If the call fails, i dispatch an ngrx action with the error message in the payload. I use a reducer to store this error in the state. In the UI, I show a pop-up whenever the error in the state changes. Now, when 2 consecutive error messages returned are same, the state gets updated twice with the same value. So, apparently, there is no change in state during second time. So, I don't get a pop for the second error message. But, I need to get pop-up every time an error message comes.

    Is this possible without dispatching a NEW action that will clear the error message when the pop-up is acknowledged. I don't want to create a new action just to clear the error message in state.

    Continue reading...

Compartilhe esta Página