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.
@h-Benitez13 You mentioned that you've seen an issue in an application where there are large network requests, which results in heavy data processing. This is visibly slowing down the performance of an application you're working on.
A few server-side recommendations come to mind:
If you don't have a server to use, you are forced to use client-side APIs:
I haven't worked with Cache API or IndexedDB professionally, but it seemed like possible solutions to your issue if you're constrained to the client.
Here's a POC of how you might use the Cache API.
Let me know if you have time to jump on a call and I'll demo this.
How to use the demo
What is happening: The first time you visit the page, we make a network request. This request gets added to the cache, so that if we try to fetch the data again within a specified time period (10 seconds), you'll get the previous data. If we fetch the data again after that period, it will refetch to get fresh data.
In a real-life context, you would cache for longer than 10 seconds, but this is useful for demo purposes. Imagine if we set the cache age to 10 minutes. During those 10 minutes, you can refresh as many times as you want and you won't have to make a huge network request again.