Merge pull request 'Fix connection indicator script duplication on SSE patches' (#12) from fix/connection-indicator-script into main
All checks were successful
CI / Deploy / test (push) Successful in 18s
CI / Deploy / lint (push) Successful in 25s
CI / Deploy / deploy (push) Successful in 1m27s

This commit was merged in pull request #12.
This commit is contained in:
2026-03-03 20:44:56 +00:00

View File

@@ -52,6 +52,8 @@ func isStale(lastPing int64) bool {
return lastPing == 0 return lastPing == 0
} }
var connectionWatcherHandle = templ.NewOnceHandle()
// ConnectionIndicator shows a small dot indicating SSE connection status. // ConnectionIndicator shows a small dot indicating SSE connection status.
// Server patches this with a timestamp; client JS detects staleness. // Server patches this with a timestamp; client JS detects staleness.
templ ConnectionIndicator(lastPing int64) { templ ConnectionIndicator(lastPing int64) {
@@ -79,7 +81,9 @@ templ ConnectionIndicator(lastPing int64) {
></div> ></div>
</div> </div>
</div> </div>
@connectionWatcherHandle.Once() {
@connectionWatcher() @connectionWatcher()
}
} }
script connectionWatcher() { script connectionWatcher() {