Skip to content
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

Exclude forwardRef and memo from stack frames #18559

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Apr 9, 2020

We can't patch the row with the new trick. So they won't be called Memo(Name) in the stack anymore.

We could give these their own "built-in" stack frame since they're conceptually HoCs. I.e.

  at Name
  at Memo

However, from a debugging perspective this is not very useful meta data and quite noisy. So I'm just going to exclude them.

@sebmarkbage sebmarkbage requested a review from gaearon April 9, 2020 18:03
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 9, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 9, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit e1885ab:

Sandbox Source
sweet-elion-wcqiv Configuration

@gaearon
Copy link
Collaborator

gaearon commented Apr 9, 2020

You kept forwardRef?

@@ -121,7 +121,7 @@ export function describeUnknownElementTypeFrameInDEV(
case REACT_FORWARD_REF_TYPE:
return describeFunctionComponentFrame(type.render, source, ownerFn);
case REACT_MEMO_TYPE:
return describeFunctionComponentFrame(type.type, source, ownerFn);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was also a bug because the inner one might not be a function.

<Outer inner={false} middle={false} outer={false} />,
<div>
<Outer inner={false} middle={false} outer={false} />
</div>,
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Apr 9, 2020

Choose a reason for hiding this comment

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

The warning no longer includes any stack because there's only a Memo. This triggers our internal warning about not expecting a stack on the warning. However, that's not realistic so let's test it with a stack.

@sizebot
Copy link

sizebot commented Apr 9, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against e1885ab

@sebmarkbage
Copy link
Collaborator Author

I kept SimpleMemoComponent and ForwardRef in the Fiber describing thing but they just describe their function name. It's only one Fiber for both the function and wrapper. I removed Memo because it's not the actual function, the function is represented by its own Fiber as a child so it's already there.

For elements I was already doing this by only naming the function.

We can't patch the row. We could give these their own "built-in" stack
frame since they're conceptually HoCs. However, from a debugging
perspective this is not very useful meta data and quite noisy. So I'm
just going to exclude them.
@sizebot
Copy link

sizebot commented Apr 9, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against e1885ab

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants