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
When listening to actions from import { Actions } from '@ngxs/store' and getting the action type with the import { getActionTypeFromInstance } from '@ngxs/store' and having an interaction with another state in the called @receiver() action, the type returned from getActionTypeFromInstance behaves weird and in some scenarios mixes the types so that there's e.g:
DISPATCHED: [ID: 123]
DISPATCHED: [ID: 999]
SUCCESSFUL: [ID: 999]
SUCCESSFUL: [ID: 999]
Sometimes it's also always just the "ID 999" on all the types.
I'd expect it to be:
DISPATCHED: [ID: 123]
DISPATCHED: [ID: 999]
SUCCESSFUL: [ID: 999]
SUCCESSFUL: [ID: 123]
OR
DISPATCHED: [ID: 123]
SUCCESSFUL: [ID: 123]
DISPATCHED: [ID: 999]
SUCCESSFUL: [ID: 999]
or something similiar. Point is, a dispatched type should also SUCCESSFUL, CANCELED or ERRORED at some time.
I hope I explained this detailed enough. Just for clarification: This issue doesn't happen when using @action(). With @action() everything works as expected. It just happens with @receiver()
When using @receiver() in the first action and inside the first action then using dispatch(new OtherAction(...)) the issue also doesn't appear. Just when both are @receiver().
When listening to actions from
import { Actions } from '@ngxs/store'
and getting the action type with theimport { getActionTypeFromInstance } from '@ngxs/store'
and having an interaction with another state in the called @receiver() action, thetype
returned fromgetActionTypeFromInstance
behaves weird and in some scenarios mixes the types so that there's e.g:Sometimes it's also always just the "ID 999" on all the types.
I'd expect it to be:
OR
or something similiar. Point is, a dispatched
type
should alsoSUCCESSFUL, CANCELED or ERRORED
at some time.I hope I explained this detailed enough. Just for clarification: This issue doesn't happen when using @action(). With @action() everything works as expected. It just happens with @receiver()
When using @receiver() in the first action and inside the first action then using
dispatch(new OtherAction(...))
the issue also doesn't appear. Just when both are @receiver().Here's also a reproduction on Stackblitz (check the console.logs, it only shows "CounterState", while it should show for 2 of the logs "OtherState"): https://stackblitz.com/edit/ngxs-emitter-example-dbv5fp?file=src%2Fapp%2Fstore%2Fother.state.ts
The text was updated successfully, but these errors were encountered: