Open luxxxoor opened 2 months ago
Thanks for raising! I agree that this is unexpected behaviour. And the reasoning is because the order of operations is:
<div
open tagSo I think the solution needs to be that we modify the generated code so that the conditional is evaluated earlier and used to inform both the rendering of scripts and the rendering of attributes.
Describe the bug RenderScriptItems is called everytime even though the ComponentScript is incapsulated in an if condition.
To Reproduce A small, self-container, complete reproduction, uploaded to a Github repo, containing the minimum amount of files required to reproduce the behaviour, along with a list of commands that need to be run. Keep it simple.
Expected behaviour I expect passing a nil action to not break rendering of the button.
Screenshots N/A
Logs
templ info
output Runtempl info
and include the output.Desktop (please complete the following information):
templ version
): v0.2.771go version
): go version go1.22.0 darwin/arm64gopls
version (gopls version
): golang.org/x/tools/gopls v0.16.1Additional context I suppose ComponentScript needs to be rendered before its used, however it does not accept nil values.
I imagine the solution would be to accept nil ComponentScript but ignore them.