Skip to content

fix(react): Add children prop for Profiler #6828

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 2 commits into from
Jan 17, 2023
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions packages/react/src/profiler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export type ProfilerProps = {
includeRender?: boolean;
// If component updates should be displayed as spans. True by default.
includeUpdates?: boolean;
// Component that is being profiled.
children?: React.ReactNode;
// props given to component being profiled.
updateProps: { [key: string]: unknown };
};
Expand Down Expand Up @@ -120,7 +122,6 @@ class Profiler extends React.Component<ProfilerProps> {
}

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