bigskysoftware / bigskysoftware/htmx
Need to consider how to cancel polling
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
Four has no way to cancel `hx-trigger="every ..."` polling.
Current state:
| | 2.x | four |
|---|---|---|
| polling | recursive `setTimeout` (`processPolling`) | `setInterval` (`src/htmx.js:830`) |
| cancel state | `internalData.cancelled` | none |
| HTTP 286 | yes | **no** |
| public API | none | none |
2.x honors a `286` response to stop polling, documented at https://htmx.org/docs/#polling
and inherited from intercooler's `X-IC-CancelPolling`. Four drops it silently.
Things to decide:
- Should four honor `286`?
- Should there be a public `htmx.cancelPolling(elt)`?
- Is cancellation permanent, or is there a `resumePolling`?
See #2576 for a 2.x proposal that added three mechanisms at once
(`286`, an `HX-Cancel-Polling` header, and `htmx.config.cancelPollingOnError`).
Corresponding 2.x issue: #2489
Contributor guide
Assessment
This issue has not been assessed yet.