Skip to content

fix: shorten sv_SE speed unit and improve usage stats submission reliability#4254

Merged
gfwilliams merged 1 commit into
espruino:masterfrom
MatrixNeoKozak:fix/improvement-1781805026201
Jun 19, 2026
Merged

fix: shorten sv_SE speed unit and improve usage stats submission reliability#4254
gfwilliams merged 1 commit into
espruino:masterfrom
MatrixNeoKozak:fix/improvement-1781805026201

Conversation

@MatrixNeoKozak

Copy link
Copy Markdown
Contributor

This PR addresses two technical issues:

  1. The 'sv_SE' speed unit was defined as 'km/tim' (6 characters), which exceeded the 5-character limit enforced by the sanity check script, leading to a known error. It has been updated to 'km/h' (4 characters), satisfying the validation requirement.

  2. The 'sendUsageStats' function in 'loader.js' used the deprecated 'XMLHttpRequest' API and incorrectly updated the 'submittedUsageInfo' state even when the POST request failed. This prevented retries of failed analytics submissions. The function has been modernized to use 'fetch' with async/await, and it now only updates 'submittedUsageInfo' upon successful completion of the request.

@bobrippling

Copy link
Copy Markdown
Collaborator

LGTM, and your fix has been validated by the CI run :)

Shall let @gfwilliams approve since this touches core files

@gfwilliams

Copy link
Copy Markdown
Member

Thanks! Yes, this looks good!

In general I wouldn't go around changing XMLHttpRequest to fetch if it's not broken though. It may be deprecated but I'm pretty sure it's not going anywhere anytime soon because of the sheer volume of old sites still using it

gfwilliams added a commit that referenced this pull request Jun 19, 2026
@gfwilliams gfwilliams merged commit c77a36d into espruino:master Jun 19, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants