Skip to content

Commit

Permalink
Updated generator to check for expired context
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerek-Yasa committed Aug 21, 2024
1 parent ae99146 commit abe0dcd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,22 @@ func (g *generator) writeTemplate(nodeIdx int, t parser.HTMLTemplate) error {
if _, err = g.w.WriteIndent(indentLevel, "templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context\n"); err != nil {
return err
}
if _, err = g.w.WriteIndent(indentLevel, "ctxErr := ctx.Err()\n"); err != nil {
return err
}
if _, err = g.w.WriteIndent(indentLevel, "if ctxErr != nil {\n"); err != nil {
return err
}
{
indentLevel++
if _, err = g.w.WriteIndent(indentLevel, "return ctxErr"); err != nil {
return err
}
indentLevel--
}
if _, err = g.w.WriteIndent(indentLevel, "}\n"); err != nil {
return err
}
if err := g.writeTemplBuffer(indentLevel); err != nil {
return err
}
Expand Down

0 comments on commit abe0dcd

Please sign in to comment.