Skip to content

Commit

Permalink
fix(sdk): Sentry.wrap doesn't enforce any keys on the wrapped compo…
Browse files Browse the repository at this point in the history
…nent props (#3332)
  • Loading branch information
krystofwoldrich authored Oct 9, 2023
1 parent 4576c83 commit ae673b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
### Fixes

- Change log output to show what paths are considered when collecting modules ([#3316](https://github.com/getsentry/sentry-react-native/pull/3316))
- `Sentry.wrap` doesn't enforce any keys on the wrapped component props ([#3332](https://github.com/getsentry/sentry-react-native/pull/3332))
- Ignore defaults when warning about duplicate definition of trace propagation targets ([#3327](https://github.com/getsentry/sentry-react-native/pull/3327))
- Use deprecated `ReactNativeTracingOptions.tracingOrigins` if set in the options ([#3331](https://github.com/getsentry/sentry-react-native/pull/3331))

Expand Down
4 changes: 1 addition & 3 deletions src/js/sdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ export function init(passedOptions: ReactNativeOptions): void {
/**
* Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.
*/
// Deprecated in https://github.com/DefinitelyTyped/DefinitelyTyped/commit/f1b25591890978a92c610ce575ea2ba2bbde6a89
// eslint-disable-next-line deprecation/deprecation
export function wrap<P extends JSX.IntrinsicAttributes>(
export function wrap<P extends Record<string, unknown>>(
RootComponent: React.ComponentType<P>,
options?: ReactNativeWrapperOptions
): React.ComponentType<P> {
Expand Down
12 changes: 12 additions & 0 deletions test/wrap.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';

import { wrap } from '../src/js/sdk';

describe('Sentry.wrap', () => {
it('should not enforce any keys on the wrapped component', () => {
const Mock: React.FC<{ test: 23 }> = () => <></>;
const ActualWrapped = wrap(Mock);

expect(typeof ActualWrapped.defaultProps).toBe(typeof Mock.defaultProps);
});
});

0 comments on commit ae673b2

Please sign in to comment.