Skip to content

Wait for proxy to be ready upon restart #1298

@osimed

Description

@osimed

Templ version
v0.3.960

Describe the bug
I'm trying encore.dev stack with templ, it feels like a hack but it working great expect browser reload when go code changes.

cmd
templ generate -proxy="http://127.0.0.1:4000" -watch -cmd="encore run --browser=never --watch=false" -ignore-pattern="encore.gen.go"

Details

  1. currently templ waits for proxy to be ready only when it is first initialized. I think it should be whenever we recompile go code.
  2. the main problem with encore is it's start some kind of an internal reverse proxy (not really sure) even when my app endpoints not picked up by encore just yet. and when templ reloads and hit those endpoints it receives a 502 Bad Gateway then I will have to manually reload the browser.

Expected behavior

  1. wait for proxy restarts for every recompile
  2. treat 502 bad gateway status code as not ready

If this makes sense I can submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions