diff --git a/cmd/templ/generatecmd/sourcemapvisualisation_templ.go b/cmd/templ/generatecmd/sourcemapvisualisation_templ.go index 2fd2cbef4..782ad31fd 100644 --- a/cmd/templ/generatecmd/sourcemapvisualisation_templ.go +++ b/cmd/templ/generatecmd/sourcemapvisualisation_templ.go @@ -46,9 +46,12 @@ func visualisation(templFileName string, left, right templ.Component) templ.Comp if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("") if err != nil { @@ -303,9 +306,12 @@ func mappedCharacter(s string, sourceID, targetID string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_7 := ctx - ctx = templ.ClearChildren(var_7) + ctx = templ.InitializeContext(ctx) + var_7 := templ.GetChildren(ctx) + if var_7 == nil { + var_7 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) // Element CSS var var_8 templ.CSSClasses = templ.Classes(templ.Class("mapped"), templ.Class(sourceID), templ.Class(targetID)) diff --git a/example/posts_templ.go b/example/posts_templ.go index 871fe312d..cf282b0f6 100644 --- a/example/posts_templ.go +++ b/example/posts_templ.go @@ -19,9 +19,12 @@ func headerTemplate(name string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("") if err != nil { @@ -282,7 +294,7 @@ func layout(name string) templ.Component { return err } // Children - err = templ.GetChildren(var_7).Render(ctx, templBuffer) + err = var_7.Render(ctx, templBuffer) if err != nil { return err } @@ -316,9 +328,12 @@ func postsTemplate(posts []Post) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_8 := ctx - ctx = templ.ClearChildren(var_8) + ctx = templ.InitializeContext(ctx) + var_8 := templ.GetChildren(ctx) + if var_8 == nil { + var_8 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("") if err != nil { diff --git a/generator/test-call/template_templ.go b/generator/test-call/template_templ.go index a87c3c6d3..7ea6aa089 100644 --- a/generator/test-call/template_templ.go +++ b/generator/test-call/template_templ.go @@ -15,9 +15,12 @@ func personTemplate(p person) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("
") if err != nil { @@ -97,9 +100,12 @@ func email(s string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_2 := ctx - ctx = templ.ClearChildren(var_2) + ctx = templ.InitializeContext(ctx) + var_2 := templ.GetChildren(ctx) + if var_2 == nil { + var_2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("
") if err != nil { diff --git a/generator/test-css-usage/template_templ.go b/generator/test-css-usage/template_templ.go index 90f7efc3f..dce316346 100644 --- a/generator/test-css-usage/template_templ.go +++ b/generator/test-css-usage/template_templ.go @@ -37,9 +37,12 @@ func Button(text string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) // Element CSS var var_2 templ.CSSClasses = templ.Classes(className(), templ.Class("&&&unsafe"), templ.SafeClass("safe")) @@ -98,9 +101,12 @@ func ThreeButtons() templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_3 := ctx - ctx = templ.ClearChildren(var_3) + ctx = templ.InitializeContext(ctx) + var_3 := templ.GetChildren(ctx) + if var_3 == nil { + var_3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // CallTemplate err = Button("A").Render(ctx, templBuffer) if err != nil { diff --git a/generator/test-doctype/template_templ.go b/generator/test-doctype/template_templ.go index 65242d35b..19396b361 100644 --- a/generator/test-doctype/template_templ.go +++ b/generator/test-doctype/template_templ.go @@ -15,9 +15,12 @@ func Layout(title, content string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // DocType _, err = templBuffer.WriteString(``) if err != nil { diff --git a/generator/test-for/template_templ.go b/generator/test-for/template_templ.go index 61b34c9ed..b5518a0ab 100644 --- a/generator/test-for/template_templ.go +++ b/generator/test-for/template_templ.go @@ -15,9 +15,12 @@ func render(items []string) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // For for _, item := range items { // Element (standard) diff --git a/generator/test-html/template_templ.go b/generator/test-html/template_templ.go index b4a499def..49b492c96 100644 --- a/generator/test-html/template_templ.go +++ b/generator/test-html/template_templ.go @@ -15,9 +15,12 @@ func render(p person) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("
") if err != nil { diff --git a/generator/test-if/template_templ.go b/generator/test-if/template_templ.go index a4fa543cb..ec5626aa3 100644 --- a/generator/test-if/template_templ.go +++ b/generator/test-if/template_templ.go @@ -15,9 +15,12 @@ func render(d data) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // If if d.IsTrue() { // StringExpression diff --git a/generator/test-ifelse/template_templ.go b/generator/test-ifelse/template_templ.go index c7ff98f58..be4ff046e 100644 --- a/generator/test-ifelse/template_templ.go +++ b/generator/test-ifelse/template_templ.go @@ -15,9 +15,12 @@ func render(d data) templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // If if d.IsTrue() { // StringExpression diff --git a/generator/test-raw-elements/template_templ.go b/generator/test-raw-elements/template_templ.go index 097a15a3b..ccea4e8fd 100644 --- a/generator/test-raw-elements/template_templ.go +++ b/generator/test-raw-elements/template_templ.go @@ -15,9 +15,12 @@ func StyleElement() templ.Component { if !templIsBuffer { templBuffer = new(bytes.Buffer) } - ctx = templ.InitializeRenderedItemsContext(ctx) - var_1 := ctx - ctx = templ.ClearChildren(var_1) + ctx = templ.InitializeContext(ctx) + var_1 := templ.GetChildren(ctx) + if var_1 == nil { + var_1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) // RawElement _, err = templBuffer.WriteString("