petaki / inertia-go

⏩ Inertia.js server-side adapter for Go.
MIT License
206 stars 11 forks source link

Don't parse templates in a render function #8

Closed Shadowfaxenator closed 3 weeks ago

Shadowfaxenator commented 4 weeks ago

You parse go templates on each render, this is inefficient. You should parse on init

petaki commented 3 weeks ago

@Shadowfaxenator Thanks for the idea! In my own applications I use embedded template files so I haven't experienced any significant performance loss. However, I have improved the template handling. I cache the parsed template on the first Render call (lazy load).