When rendering a page using Incremental Static Regeneration a *conditional statement is erroneously applied to the wrong element.
*I'm referring to conditional rendering expressions of the following form:
<div>
{true && <div />}
<div />
</div>
npm install, and *npm run dev<div>
<div class="SHOW"></div>
</div>
<div>
<div class="NO_SHOW"></div>
</div>
*npm run build && npm run start yields the same problem
A single div with the class SHOW should be added to the DOM regardless of the environment.
Could you please upgrade to next@canary and try this again? We've fixed a lot of CSS-related things in the newest canary.
Could you please upgrade to
next@canaryand try this again? We've fixed a lot of CSS-related things in the newest canary.
Okay. Just did this, and the problem persists.
I should add that this isn't really CSS related. It seems like the conditional statement is being applied to the wrong element somehow. The CSS was just to illustrate that.
Thanks, we'll take a peek soon!
My original example had a lot going on. I made a clean new repo and was able to build up to triggering the bug.
It seems to be related to rendering pages that use Incremental Static Regeneration. I still can't identify why the conditional is being applied to the wrong element because it's a completely silent error (AFAIK even if the boolean was flipped the result I'm getting from Vercel would still be impossible).
Interestingly, the only valid evaluations of the following code

are:
<div>
<div class="SHOW"></div>
</div>
or
<div>
<div class="NO_SHOW"></div>
<div class="SHOW"></div>
</div>
However, the Vercel page is the following:

which should be impossible. Hence, this probably has to be a problem in either how Vercel transpiles my code or how the browser interprets the transpiled code. Because I've tested a couple different browsers and found the same problem across all of them, it seems to me that Vercel's transpiler likely has a bug.
My original example had a lot going on. I made a clean new repo and was able to build up to triggering the bug.
It seems to be related to rendering pages that use Incremental Static Regeneration. I still can't identify why the conditional is being applied to the wrong element because it's a completely silent error (AFAIK even if the boolean was flipped the result I'm getting from Vercel would still be impossible).
Interestingly, the only valid evaluations of the following code
are:
<div> <div class="SHOW"></div> </div>or
<div> <div class="NO_SHOW"></div> <div class="SHOW"></div> </div>However, the Vercel page is the following:
which should be impossible. Hence, this probably has to be a problem in either how Vercel transpiles my code or how the browser interprets the transpiled code. Because I've tested a couple different browsers and found the same problem across all of them, it seems to me that Vercel's transpiler likely has a bug.
Rewrote the bug report to reference this reproduction.
Did some investigating:
next.config.js with target: 'experimental-serverless-trace'next buildconsole.log in _app logged out /404 which is unexpectedSo this is definitely a bug in Next.js, we'll fix it 馃檹
Did some investigating:
Added a
next.config.jswithtarget: 'experimental-serverless-trace'Ran
next buildThe
console.login_applogged out/404which is unexpectedSo this is definitely a bug in Next.js, we'll fix it 馃檹
Sounds good. Thank you for the quick response!
Hi, this should be fixed in v9.5.4-canary.16 of Next.js please upgrade and give it a try!
Thanks a million! I'll confirm everything is fixed when I get home evening.
Most helpful comment
Did some investigating:
next.config.jswithtarget: 'experimental-serverless-trace'next buildconsole.login_applogged out/404which is unexpectedSo this is definitely a bug in Next.js, we'll fix it 馃檹