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

Disable consoleWithStackDev Transform except in RN/WWW #30313

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Jul 10, 2024

Stacked on #30308.

This is now a noop module so we can stop applying the transform of console.error using the Babel plugin in the mainline builds. I'm keeping the transform for RN/WWW for now although it might be nice if the transform moved into those systems as it gets synced instead of keeping it upstream.

In jest tests we're already not running the forks for RN/WWW so we don't need it at all there.

@sebmarkbage sebmarkbage requested a review from hoxyq July 10, 2024 23:08
Copy link

vercel bot commented Jul 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 12, 2024 5:32pm

@sebmarkbage
Copy link
Collaborator Author

sebmarkbage commented Jul 10, 2024

sebmarkbage added a commit that referenced this pull request Jul 11, 2024
This code is getting deleted in #30313 anyway but it should've been
gated all along.

This code exists to basically manually transpile console.error to
consoleWithStackDev because the transpiler doesn't work on `.apply` or
`.bind` or the dynamic look up. We only apply the transform in DEV so we
should've only done this in DEV.

Otherwise these logs get silenced in prod.
github-actions bot pushed a commit that referenced this pull request Jul 11, 2024
This code is getting deleted in #30313 anyway but it should've been
gated all along.

This code exists to basically manually transpile console.error to
consoleWithStackDev because the transpiler doesn't work on `.apply` or
`.bind` or the dynamic look up. We only apply the transform in DEV so we
should've only done this in DEV.

Otherwise these logs get silenced in prod.

DiffTrain build for [a09950e](a09950e)
Comment on lines -68 to +67
if (methodName === 'error' && __DEV__) {
error.apply(console, newArgs);
} else if (methodName === 'warn' && __DEV__) {
warn.apply(console, newArgs);
} else {
// $FlowFixMe[invalid-computed-prop]
console[methodName].apply(console, newArgs); // eslint-disable-line react-internal/no-production-logging
}
// $FlowFixMe[invalid-computed-prop]
console[methodName].apply(console, newArgs); // eslint-disable-line react-internal/no-production-logging
Copy link
Contributor

@hoxyq hoxyq Jul 12, 2024

Choose a reason for hiding this comment

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

Looking at changes in facebook-www/ReactDOM-dev.modern.js, this could call original console methods?

Or are they guaranteed to be transformed at this point? So we end up calling same warn and error from consoleWithStackDev?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are not guaranteed to be transformed. This affects not just this but the Flight log replaying. In other words, it won't go through the warning module in www/rn. But both of these are only affecting Flight so we just need to figure that out once Flight when added to www what to do avoid Flight logs in www.

@sebmarkbage
Copy link
Collaborator Author

This PR itself currently leaves the transform on for RN OSS but #30320 removes that but I figured that's an independent decision. I can rebase the other PR.

In jest tests we're already not running the forks for RN/WWW so we don't
need them at all there.
@sebmarkbage sebmarkbage merged commit ff89ba7 into facebook:main Jul 12, 2024
185 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 12, 2024
Stacked on #30308.

This is now a noop module so we can stop applying the transform of
console.error using the Babel plugin in the mainline builds. I'm keeping
the transform for RN/WWW for now although it might be nice if the
transform moved into those systems as it gets synced instead of keeping
it upstream.

In jest tests we're already not running the forks for RN/WWW so we don't
need it at all there.

DiffTrain build for commit ff89ba7.
github-actions bot pushed a commit that referenced this pull request Jul 12, 2024
Stacked on #30308.

This is now a noop module so we can stop applying the transform of
console.error using the Babel plugin in the mainline builds. I'm keeping
the transform for RN/WWW for now although it might be nice if the
transform moved into those systems as it gets synced instead of keeping
it upstream.

In jest tests we're already not running the forks for RN/WWW so we don't
need it at all there.

DiffTrain build for [ff89ba7](ff89ba7)
felixshiftellecon added a commit to felixshiftellecon/react that referenced this pull request Jul 24, 2024
Stacked on facebook#30308.

This is now a noop module so we can stop applying the transform of
console.error using the Babel plugin in the mainline builds. I'm keeping
the transform for RN/WWW for now although it might be nice if the
transform moved into those systems as it gets synced instead of keeping
it upstream.

In jest tests we're already not running the forks for RN/WWW so we don't
need it at all there.
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.

3 participants