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
feat: Redux Integration in @sentry/react #2717
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jennmueng
changed the title
(WIP) feat: Redux Integration in @sentry/react
feat: Redux Integration in @sentry/react
Jul 7, 2020
jennmueng
force-pushed
the
feat/redux-integration
branch
from
July 7, 2020 12:07
9bc449b
to
e391e82
Compare
kamilogorek
reviewed
Jul 7, 2020
kamilogorek
reviewed
Jul 7, 2020
AbhiPrasad
reviewed
Jul 7, 2020
AbhiPrasad
reviewed
Jul 7, 2020
AbhiPrasad
reviewed
Jul 9, 2020
AbhiPrasad
reviewed
Jul 9, 2020
AbhiPrasad
reviewed
Jul 9, 2020
AbhiPrasad
approved these changes
Jul 10, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kamilogorek
approved these changes
Jul 13, 2020
jennmueng
force-pushed
the
feat/redux-integration
branch
from
July 14, 2020 07:45
722f1d4
to
e00cabd
Compare
jennmueng
force-pushed
the
feat/redux-integration
branch
from
July 14, 2020 10:10
e00cabd
to
7c75f3b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Redux integration as an export from
@sentry/react
Exports a
createReduxEnhancer
.Usage would look something like:
Notes:
Store Enhancer not Middleware
Instead of a redux middleware, this is a store enhancer.
Initially, this started out as middleware where the action was logged as a breadcrumb and a global event processor attached the state to each event.
The reason it was changed to an enhancer instead of middleware is that attaching the latest state to each event does not sync down to native events in
@sentry/react-native
, but setting it on on the scope does. Setting the scope on every call with a middleware would not be ideal as middleware are called BEFORE reducers update the latest state; if an event occurs then the state sent would be the previous state instead of the latest.With the current store enhancer implementation, every time an action is dispatched, the latest state is processed by calling
const newState = reducer(state, action)
and the latest state is set on the scope. This implementation does have one downside we need to keep in mind is that it is pretty heavy, as state could be huge and taking it and setting it on the scope each time could be a heavy operation.Normalization Depth
As we normalize events by default to a depth of 3, if the user wants to view their whole state tree they would have to increase the depth by setting
normalizeDepth
when they initialize the SDK.Next Steps