a-h / templ

A language for writing HTML user interfaces in Go.
https://templ.guide/
MIT License
8.4k stars 277 forks source link

feat: `ResetContext` func to allow resetting initialized context #989

Open kanstantsin-chernik opened 3 weeks ago

kanstantsin-chernik commented 3 weeks ago

The feature allows a context to be reset before reusing it in multiple go-routines (see the issue).

An alternative solution would be to always create a new context, which would be overkill for 99.9% of single-threaded use cases.

joerdav commented 1 week ago

My concern on this one is the unexpected effects that reseting the context could cause.

We should either mitigate these in some way with this solution, or document the possible outcomes.