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

Cater for the omission of if:false when replacing if:true with lwc:true #4517

Open
CraigTildesley opened this issue Sep 2, 2024 · 1 comment

Comments

@CraigTildesley
Copy link

CraigTildesley commented Sep 2, 2024

Is your feature request related to a problem? Please describe.
There are plenty of situations within lwc development where the if:false has been used but this hasn't been catered for by the lwc:if & lwc:else construct.
as far as I can see the omission of lwc:iffalse leads to 2 ugly solutions within the code:

  1. having an empty lwc:if block followed by a populated lwc:else
  2. having to write a not version of the js function eg lwc:if={notShowThing}

Describe the solution you'd like
I would like to allow for the existing use case without awful code or having to code bloat with extra code eg notShowThing={return !showThing}

Describe alternatives you've considered
As far as I can see there are 2 elegant solutions to this issue.
Either:

  1. provide a lwc:ifnot operator within the markup eg lwc:ifnot={showThing}
  2. provide a ! operator as part of the definition lwc:if={!showThing}
@nolanlawson
Copy link
Collaborator

Thanks for the feedback. We are working on solution #2 as part of what we're calling "complex template expressions." (It is still under active development and not released yet.) This would allow you to use ! in your expressions.

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

No branches or pull requests

2 participants