zooniverse / front-end-monorepo

A rebuild of the front-end for zooniverse.org
https://www.zooniverse.org
Apache License 2.0
104 stars 29 forks source link

Swap superagent for a fetch API based request library #317

Open srallen opened 6 years ago

srallen commented 6 years ago

Package lib-panoptes-js

Feature or Issue Description The panoptes.js library currently uses superagent for http request. Superagent is a mature and robust library that handles common security concerns and uses XHR for full browser support. However, we have decided to not support IE11 and all other modern browsers support the the Fetch API: https://caniuse.com/#search=fetch

Since we do not need to support XHR anymore and because we're starting to use service workers (SWs do not support XHR either), perhaps we should switch to a Fetch API based request library. frisbee looks promising.

(There's no rush to do this either)

To Dos

rogerhutchings commented 5 years ago

There's also the option of using a Relay client as more GraphQL resources get added, which I would prefer since we over/underfetch a fair bit.

srallen commented 5 years ago

I'd add that as an addition, perhaps as a set of pre-written helpers like I've done already, not as a replacement of fetch since fetch is native and I don't think the RESTful endpoints are going away anytime soon?

goplayoutside3 commented 3 months ago

We plan to continue using Next.js in app-root and app-project for the foreseeable future, and he Next.js app router expects data-fetching to use fetch (if fetching data serverside). I've added this Issue to the FEM planning spreadsheet and Maintenance board with the goal of replacing superagent with native fetch in lib-panoptes-js. This work is also linked to #5995 because PJC uses superagent, and we also want to remove legacy PJC from FEM in favor of lib-panoptes-js.