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

t-if="" generates invalid javascript when compiling the template #1634

Open
LucasLefevre opened this issue Aug 14, 2024 · 1 comment
Open

Comments

@LucasLefevre
Copy link
Contributor

t-if="" generates code which is not valid javascript.

it generates code which looks like

"""
if () {
   // ...
}
"""

It crashes when owl tries to compile the code
Error: Failed to compile template "Root": Unexpected token ')'

The error message isn't very helpful to debug/fix the xml template, especially if the template is quite large and the generated code is also big.

class Root extends Component {
    static components = {};
    static template = "Root"
}
<templates>
  <t t-name="Root">
    <div t-if="">Hi!</div>
  </t>
</templates>

👉 Playground

@LucasLefevre LucasLefevre changed the title t-if="" throws an unfriendly error message t-if="" generates invalid javascript when compiling the template Aug 16, 2024
@ged-odoo
Copy link
Contributor

ged-odoo commented Sep 3, 2024

yeah, seems like we could improve this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants