Skip to content

Commit 98038da

Browse files
authored
fix(react): Add children prop for Profiler (#6828)
1 parent d34fd36 commit 98038da

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/react/src/profiler.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export type ProfilerProps = {
2121
includeRender?: boolean;
2222
// If component updates should be displayed as spans. True by default.
2323
includeUpdates?: boolean;
24+
// Component that is being profiled.
25+
children?: React.ReactNode;
2426
// props given to component being profiled.
2527
updateProps: { [key: string]: unknown };
2628
};
@@ -120,7 +122,6 @@ class Profiler extends React.Component<ProfilerProps> {
120122
}
121123

122124
public render(): React.ReactNode {
123-
// eslint-disable-next-line react/prop-types
124125
return this.props.children;
125126
}
126127
}
@@ -136,7 +137,7 @@ class Profiler extends React.Component<ProfilerProps> {
136137
function withProfiler<P extends Record<string, any>>(
137138
WrappedComponent: React.ComponentType<P>,
138139
// We do not want to have `updateProps` given in options, it is instead filled through the HOC.
139-
options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps'>>,
140+
options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,
140141
): React.FC<P> {
141142
const componentDisplayName =
142143
(options && options.name) || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;

0 commit comments

Comments
 (0)