Skip to content

feat(devtools): display event payloads for withTrackedReducer#295

Open
OleksandrOleniuk wants to merge 2 commits intoangular-architects:mainfrom
OleksandrOleniuk:with-tracked-reducer-events
Open

feat(devtools): display event payloads for withTrackedReducer#295
OleksandrOleniuk wants to merge 2 commits intoangular-architects:mainfrom
OleksandrOleniuk:with-tracked-reducer-events

Conversation

@OleksandrOleniuk
Copy link
Copy Markdown

@OleksandrOleniuk OleksandrOleniuk commented Apr 3, 2026

Closes #294 RFC

This PR implements the enhancements proposed in the RFC, upgrading the DevTools integration to display full event payloads when using withTrackedReducer.

Copy link
Copy Markdown
Collaborator

@rainerhahnekamp rainerhahnekamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR. Please find my comment below


export const currentActionNames = new Set<string>();

export const currentEvents = new Set<EventInstance<string, any>>();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
    }),
  ),
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Expose Event Payload in Redux DevTools via withTrackedReducer

2 participants