-
Notifications
You must be signed in to change notification settings - Fork 44
Alternative Event Tracking: withTrackedReducer
#266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…racking and add tests
`withEventsTracking` is failing in some cases, wihch is due to its initial design spec. `withTrackReducer` provides a potential better alternative.
|
I did a preliminary review for now and will give a more formal one in the evening. Looks good though. One piece missing at the moment: some sort of documentation reference |
Co-authored-by: Michael Small <33669563+michael-small@users.noreply.github.com>
|
I see it as temporarily. In the end, we need support for meta-reducers in the core... |
In that respect, I think this code/approach as-is minus the outstanding items seems legit. But with those outstanding items, I defer to @wolfmanfx on the outstanding considerations. I imagine there will be some more reviewing opportunity then. |
Removed withEventsTracking. Use withTrackedReducer instead for automatic DevTools action naming from events. - Remove withEventsTracking feature and its test file - Export withTrackedReducer as the replacement - Remove unused onInit/DevtoolsHookContext from devtools types - Remove devtoolsEventsTracker and eventsTracking option - Update demo app to use withTrackedReducer
|
@rainerhahnekamp I have updated / cleaned the branch. I also vote for the temp solution with the "withTrackedReducer". |
Summary
This PR introduces
withTrackedReduceras an alternative approach to tracking reducer-based state changes in Redux DevTools. It addresses limitations in the originalwithEventsTrackingimplementation.The original implementation (based on #231) attempted to automatically track reducer-based state changes via the glitch tracker. However, this approach has fundamental limitations that cannot be resolved with the specified approach.
Several edge cases are documented in the skipped tests within
with-events-tracking.spec.ts.This PR introduces an alternative way, where end users have to use the wrapperd function
withTrackedReducerwhich calls internallyupdateStateusing the event's name.If we proceed with this approach, the following items need to be completed:
withTrackedReducerusage and when to use it vswithReducerwithEventsTrackingapproach (if applicable)withTrackedReduceris only used with stores that have devtools and glitch tracking enabled