NuxtN
Nuxt2y ago
18 replies
Termonna

Nuxt ignores boolean logic

I've encountered a bizarre and infinitely strange behavior in Nuxt3 (@3.8.0), and I don't even know how to describe it, but I've attempted to illustrate it with screenshots.

There are two divs using v-if and v-else directives, and Nuxt rendered both the v-if wrapper and the content from the v-else block simultaneously. This should be physically impossible, as boolean logic implies either displaying the v-if block or the v-else block, but not displaying the v-if block with content from the v-else block.

Please, explain to me how this could have happened and what's under the hood of Nuxt3 to allow such behavior?

Important note:
As you can see in the screenshots, the v-if section and the content of v-else depend on the computed variable
role
. After rendering, the
role
variable changes in a way that it no longer satisfies the condition from v-if, but it starts satisfying the condition for displaying the content inside v-else.

Expected behavior: upon changing the
role
variable, the v-if section is ignored, and only the v-else section with the corresponding content is used.

@moderator I apologize to the moderators for the ping, but the issue appears to be critical.
image.png
image.png
Was this page helpful?