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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: After upgrading to babel-plugin-transform-react-constant-elements v7.17.6 our application has stopped working correctly #14363
Comments
Hey @budarin! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
Unfortunately it's quite hard to understand what's the bug, we need an example or a repository we can clone to reproduce it. Which was the previous |
previous working version was 7.16.7 I'll try to create repo for demonstrating the bug |
We're seeing this as well where our app stopped working correctly after upgrading from 7.16.7 to 7.17.6 for @babel/plugin-transform-react-constant-elements. I'm still investigating on our side to try get a reliable reproduction, however from what I've seen, I think a component is getting the wrong prop value (or the prop value is getting stale somehow). I assume it's a regression from #12975, but I don't understand the PR well enough to identify what could be causing the broken behaviour. I'll post an update if I can determine the exact failure case. |
Yes, it's likely to be caused by that PR but I'm not sure about what in that PR could cause this bug. Unfortunately without a reproduction test we cannot really revert the PR and re-land it fixed, because we would just risk re-introducing the bug. That PR should only change the behavior of functions passed as props, if that may help tracking down the component that is affected by this bug. |
Here is the demo with the bug' |
Thank you! |
It took a while, but thanks to your repository I found the bug 馃コ |
This code: function RoutesComponent() {
return (
<Routes>
{(c) => {
{
const Component = c;
return <Component />;
}
}}
</Routes>
);
} is transformed to this: var _Component;
function RoutesComponent() {
return (
<Routes>
{(c) => {
{
const Component = c;
return _Component || (_Component = <Component />);
}
}}
</Routes>
);
} which is wrong because |
Mentioning this as a bug/breaking change in the broken versions would be hugely helpful even though it's apparently fixed now. I spent a full day tracking down this bug. |
Also, is there an ETA for #14536 to be published? This is a pretty serious bug if pushed to production which irreversibly corrupts data in our app. Given the dangers, I think version 7.17.6 should be pulled. |
Fix published |
Today I updated almost all dependencies in the project, including The problem has remained - the project does not work with the plugin :( |
|
@budarin is this issue still affecting you? We've been hesitant to upgrade again for fear of re-introducing a critical flaw that does irreversible damage to user's data, but I haven't seen anyone else mention they're still having trouble. |
The problem is still actual (I have upgraded the dependencies to the latest versions) |
@nicolo-ribaudo do you have any thoughts on resolving this? Babel has always been reliable for us until this issue began, and so far it's already sapped more than an entire day's work for us, and it would be far far worse had we pushed it to production before discovering the bug. |
@slapbox Can you provide a reproduction repo so we can take a look? It would be great if you can come up with a minimal reproducible examples like Nicol貌 did in #14363 (comment). |
Thanks for the reply @JLHwung. Presumably @budarin's repro should work: https://github.com/budarin/plugin-transform-react-constant-elements-bug It doesn't break our app, as far as I know - but it's that "as far as I know" that's troubling to us, because it took me nearly a month to even notice the subtle bug this plugin introduced for us last time. Additionally, it can be quite difficult to create a repro for an error in a transpiler, much less a minimally reproducible one - unless you're pretty well versed in what the transpiler is doing, as @nicolo-ribaudo as the number 3 contributor presumably is. |
If that repository still has the bug, it's enough for us. I'm on vacation until the end of next week, but I'll then take a look again at this. |
I can reproduce the bug on REPL. @nicolo-ribaudo Enjoy the vacation. I will take a look today. |
Fixed in |
Thanks! 馃挜馃挜馃挜 |
馃捇
How are you using Babel?
babel-loader (webpack)
Input code
Configuration file name
babel.config.js
Configuration
Current and expected behavior
After updating the plugin, navigation in the application with react-router with code splitting stopped working
If you disable the plugin, everything works fine
Environment
Possible solution
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: