Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migration from axios to fetch #42

Merged
merged 3 commits into from
Jan 31, 2024
Merged

Conversation

Saghen
Copy link
Contributor

@Saghen Saghen commented Jun 1, 2023

As part of my work on ActivityWatch/aw-watcher-web#103, a need to switch from Axios (based on XMLHTTPRequest) to native fetch arose due to the removal of XMLHTTPRequest in Service Workers. These are a requirement for Manifest V3 with Manifest V2 being removed from Chrome soon (see).

Notably, Node.JS gained support for fetch by default in v18 with v16 introducing it via the --experimental-fetch flag. According to the release schedule found here, v16 has been moved to maintenance and will reach end of life on September 11th. Unfortunately, this means that this PR would break support for a maintenance release of Node in the meantime. Users of v16 could either enable support for fetch or use one of the many polyfills.

This PR also removes the timeout option which, if implemented, would involve using a Promise.race and AbortController although I'd be curious if this option is in use. I'm willing to implement it if desired!

@Saghen
Copy link
Contributor Author

Saghen commented Jun 29, 2023

Friendly ping in case this fell under the radar, but no rush! @ErikBjare

Copy link
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely missed this, sorry!

Looks good, but a few comments and an issue.

src/aw-client.ts Show resolved Hide resolved
src/aw-client.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
@Saghen
Copy link
Contributor Author

Saghen commented Jan 30, 2024

Changes made based off your comments. I haven't had the chance to test it manually but all tests are passing

@ErikBjare
Copy link
Member

Haven't tested myself, but looks good!

Thank you so much for this ❤️

@ErikBjare
Copy link
Member

ErikBjare commented Jan 31, 2024

I assume the failing tests is just due to an old node-version in CI. Bumping to 18 and hoping it passes.

Edit: It did 🎉

@ErikBjare ErikBjare merged commit d4ff648 into ActivityWatch:master Jan 31, 2024
0 of 2 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.

2 participants