Skip to content

Add support for owner stacks#48782

Closed
rickhanlonii wants to merge 1 commit into
facebook:mainfrom
rickhanlonii:export-D68285628
Closed

Add support for owner stacks#48782
rickhanlonii wants to merge 1 commit into
facebook:mainfrom
rickhanlonii:export-D68285628

Conversation

@rickhanlonii
Copy link
Copy Markdown
Member

@rickhanlonii rickhanlonii commented Jan 19, 2025

Summary:
React currently has a babel transform to replace all console.error calls with a special function for RN and www. The function adds component stacks, which doesn't make sense in an owner stack world because:

  • not all console.error calls are replaced, creating inconsistency
  • oss web users don't append component stacks to console.log any more
  • component stacks can be accessed for DEV modals like logbox with captureOwnerStack
  • owner stacks are already added to the console with createTask if you use console.error directly
  • the redirection is the single greatest source of fragility in the logbox reporting pipeline

So we're removing this as part of the owner stack rollout. This should only be enabled with owner stacks.

Example Screen

Before:
image

After:
image

[General][Added] - Add full owner stack support to React Native

Differential Revision: D68285628

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jan 19, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D68285628

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D68285628

rickhanlonii added a commit to rickhanlonii/react-native that referenced this pull request Jan 19, 2025
Summary:

React currently has a babel transform to replace all `console.error` calls with a special function for RN and www. The function adds component stacks, which doesn't make sense in an owner stack world because:
- not all console.error calls are replaced, creating inconsistency
- oss web users don't append component stacks to console.log any more
- component stacks can be accessed for DEV modals like logbox with `captureOwnerStack`
- owner stacks are already added to the console with createTask if you use console.error directly
- the redirection is the single greatest source of fragility in the logbox reporting pipeline

So we're removing this as part of the owner stack rollout. This should only be enabled with owner stacks. 

## Example Screen
Before:
{F1974436644}

After:
{F1974436645} 

[General][Added] - Add full owner stack support to React Native

Differential Revision: D68285628
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D68285628

rickhanlonii added a commit to rickhanlonii/react-native that referenced this pull request Jan 20, 2025
Summary:

React currently has a babel transform to replace all `console.error` calls with a special function for RN and www. The function adds component stacks, which doesn't make sense in an owner stack world because:
- not all console.error calls are replaced, creating inconsistency
- oss web users don't append component stacks to console.log any more
- component stacks can be accessed for DEV modals like logbox with `captureOwnerStack`
- owner stacks are already added to the console with createTask if you use console.error directly
- the redirection is the single greatest source of fragility in the logbox reporting pipeline

So we're removing this as part of the owner stack rollout. This should only be enabled with owner stacks. 

## Example Screen
Before:
{F1974436644}

After:
{F1974436645} 

[General][Added] - Add full owner stack support to React Native

Differential Revision: D68285628
rickhanlonii added a commit to rickhanlonii/react-native that referenced this pull request Jan 20, 2025
Summary:

React currently has a babel transform to replace all `console.error` calls with a special function for RN and www. The function adds component stacks, which doesn't make sense in an owner stack world because:
- not all console.error calls are replaced, creating inconsistency
- oss web users don't append component stacks to console.log any more
- component stacks can be accessed for DEV modals like logbox with `captureOwnerStack`
- owner stacks are already added to the console with createTask if you use console.error directly
- the redirection is the single greatest source of fragility in the logbox reporting pipeline

So we're removing this as part of the owner stack rollout. This should only be enabled with owner stacks. 

## Example Screen
Before:
{F1974436644}

After:
{F1974436645} 

[General][Added] - Add full owner stack support to React Native

Differential Revision: D68285628
Summary:

React currently has a babel transform to replace all `console.error` calls with a special function for RN and www. The function adds component stacks, which doesn't make sense in an owner stack world because:
- not all console.error calls are replaced, creating inconsistency
- oss web users don't append component stacks to console.log any more
- component stacks can be accessed for DEV modals like logbox with `captureOwnerStack`
- owner stacks are already added to the console with createTask if you use console.error directly
- the redirection is the single greatest source of fragility in the logbox reporting pipeline

So we're removing this as part of the owner stack rollout. This should only be enabled with owner stacks. 

## Example Screen
Before:
{F1974436644}

After:
{F1974436645} 

[General][Added] - Add full owner stack support to React Native

Reviewed By: hoxyq

Differential Revision: D68285628
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D68285628

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 967ef32.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 20, 2025
@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rickhanlonii in 967ef32

When will my fix make it into a release? | How to file a pick request?

Comment on lines +198 to +200
if (!hasComponentStack(args) && React.captureOwnerStack != null) {
stack = React.captureOwnerStack();
if (!hasComponentStack(args)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does this get called twice, is args mutated between invocations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants