bigskysoftware / bigskysoftware/htmx

Need to consider how to cancel polling

Open
#4,040 1 comment 0 reactions 1 assignee Claimed by @1cg View on GitHub
htmx 4
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.