feat(devtools): display event payloads for withTrackedReducer#295
feat(devtools): display event payloads for withTrackedReducer#295OleksandrOleniuk wants to merge 2 commits intoangular-architects:mainfrom
Conversation
rainerhahnekamp
left a comment
There was a problem hiding this comment.
Thanks for the quick PR. Please find my comment below
|
|
||
| export const currentActionNames = new Set<string>(); | ||
|
|
||
| export const currentEvents = new Set<EventInstance<string, any>>(); |
There was a problem hiding this comment.
to be honest, I think we don't even have to bring a queue for the events. withTrackedReducer should consume the event and immediately send it devtools.
The action names were only necessary when are collecting the state changes via an effect.
Because of that, I think this whole PR could be much shorter.
There was a problem hiding this comment.
Thanks for the comment
I just based it on the existing functionality. Could you explain what do you mean by
withTrackedReducer should consume the event and immediately send it devtools
I could inject DevtoolsSyncer after updateState and call some syncing, but i don't think this is a nice way
caseReducers.map((caseReducer) =>
events.on(...caseReducer.events).pipe(
tap((event) => {
const state = untracked(() => getState(store));
const result = caseReducer.reducer(event, state);
const updaters = Array.isArray(result) ? result : [result];
updateState(store, event.type, ...updaters);
}),
),
),
Closes #294 RFC
This PR implements the enhancements proposed in the RFC, upgrading the DevTools integration to display full event payloads when using withTrackedReducer.