odoo/odoo#234872

Created by Training, Max Whale (mawh)
Merged at fda587b1af559cfe1fbcdbb0b04fca4f18fd5d0d

Statuses:

label
odoo-dev:saas-18.3-iot_base-longpolling-abort-mawh
head
3895da197da34af2d1531ad4a6f9a29fa926d2ca
merged
4 weeks ago by Training, Max Whale (mawh)
odoo/odoo
saas-18.3 #234872
saas-18.4 #234955
19.0 #234966

[FIX] iot_base: event listener requests not cancelling

Steps to reproduce:
1. Pair an IoT box
2. In the IoT form view, click on any device, then click back to return to the IoT form view.
3. Repeat this step multiple times. If you have devtools open, you can see a /event fetch request every time you open the device form.

Expected behaviour:
- When a new request is made, the previous request is cancelled.

Actual behaviour:
- The previous requests remain active, and eventually no further requests are possible due to browser limits.

This behaviour was broken when the longpolling was changed to use the fetch method instead of Odoo's rpc method. This commit restores the behaviour by using an AbortController instance which is aborted when stopPolling is called.

Manual Forward Port of Enterprise PR: odoo/enterprise#98985


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr