feat: migration from axios to fetch#42
Merged
ErikBjare merged 3 commits intoActivityWatch:masterfrom Jan 31, 2024
Merged
Conversation
Contributor
Author
|
Friendly ping in case this fell under the radar, but no rush! @ErikBjare |
ErikBjare
requested changes
Nov 15, 2023
Member
ErikBjare
left a comment
There was a problem hiding this comment.
I completely missed this, sorry!
Looks good, but a few comments and an issue.
Contributor
Author
|
Changes made based off your comments. I haven't had the chance to test it manually but all tests are passing |
Member
|
Haven't tested myself, but looks good! Thank you so much for this ❤️ |
Member
|
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 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-fetchflag. 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
timeoutoption which, if implemented, would involve using aPromise.raceandAbortControlleralthough I'd be curious if this option is in use. I'm willing to implement it if desired!