Replies: 1 comment 1 reply
-
You can use Route Segment Config to control the cache strategy for the entire route segment, which is the same as extending the fetch cache,And applies to other third-party request libraries, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Ability to choose how XHR request should be cached
same like the
fetch()
method which extends the cache propertyRevalidating the XHR request.
ability to set the revalidation time for the XHR request
Ability to Tag the Cache and revalidate it using an on-demand revalidating
Non-Goals
No response
Background
Why do we need to use XHR request?
I know you might think
XML HTTP Request
is an old javascript API that is now deprecated because of synchronous usage, BUT it's still in use because of these features:you can use onprogress method to monitor your upload to the server calculate when your packet will be ended completely to the server, and track your upload based on percentage.
Ability to execute a function and react to Events like:
abort | error | load | loadend | loadstart | progress | readystatechange | timeout
you can use Regex to scan the XML content
these are just programming capabilities that XMLHttpRequest has. but there is far more power in XHR that can bring Nextjs to a better framework.
In the modern web, When XML HTTP Request is used?
XMLHttpRequest (XHR) objects are used to interact with servers. You can retrieve data from a URL without doing a full page refresh. but the main is to update just part of a page without disrupting what the user is doing or refreshing the whole page. link
in most cases XHR is used in File Uploads or the places where monitoring the data without disruption is essential.
Proposal
I'm interested in contributing but I feel XHR is being used in Nextjs but it needs to become something greater for developers to use and I see a potential for making Tools from it, unfortunately, I may not be an expert in React, but I am well-versed in the workings of HTTP and love to hear from you.
Beta Was this translation helpful? Give feedback.
All reactions