Skip to content

fix(react): Fix Redux integration failing with reducer injection #16106

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

Merged
merged 4 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#16017 :
Run fix:prettier
  • Loading branch information
AntoineDuComptoirDesPharmacies committed Apr 24, 2025
commit 16b51f453b6b01d664b0d697a27487ecd24115cf
4 changes: 2 additions & 2 deletions packages/react/src/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ function createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>):
store.replaceReducer = new Proxy(store.replaceReducer, {
apply: function (target, thisArg, args) {
target.apply(thisArg, [sentryWrapReducer(args[0])]);
Copy link
Member

@s1gr1d s1gr1d Apr 23, 2025

Choose a reason for hiding this comment

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

Just saw your question here: LeComptoirDesPharmacies@631f71e

I am wondering if we can do better than accessing the index [0] directly ?

Not really as we need to use the first argument :/

}
})
},
});

return store;
};
Expand Down
16 changes: 8 additions & 8 deletions packages/react/test/redux.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,14 @@ describe('createReduxEnhancer', () => {

const ACTION_TYPE = 'UPDATE_VALUE';
const reducer = (state: Record<string, unknown> = initialState, action: { type: string; newValue: any }) => {
if (action.type === ACTION_TYPE) {
return {
...state,
value: action.newValue,
};
}
return state;
};
if (action.type === ACTION_TYPE) {
return {
...state,
value: action.newValue,
};
}
return state;
};

const store = Redux.createStore(reducer, enhancer);

Expand Down
Loading