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.
SWR provides a way to use a custom cache provider. We now store the API calls in local storage as soon as the user reloads the page/exits the tab.
Example below with each API call throttled by 1 second:
Without cache (approx 12 seconds):
![Export-1714739655557](https://private-user-images.githubusercontent.com/19825455/327754530-f18c16b1-9e61-4a4a-8da5-c232bf542bf0.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MTkxOTQsIm5iZiI6MTcyNDcxODg5NCwicGF0aCI6Ii8xOTgyNTQ1NS8zMjc3NTQ1MzAtZjE4YzE2YjEtOWU2MS00YTRhLThkYTUtYzIzMmJmNTQyYmYwLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDAwMzQ1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4M2ZmYjJkOTY2NGNiZDZkNmM1ZjVjMzBiYjUzYTc0NGJhNzU5ZGMzYTcyNzE3ZjYxMTlmMmJhNjA1NGRkMTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-VrEm8I6d6bUKvik3baC9Wv0VojLRNRvS1G5Ojj87Mw)
With cache (near instant):
![Export-1714739814425](https://private-user-images.githubusercontent.com/19825455/327755139-7d38d8bb-770d-4871-a0e9-7aa5dce9da45.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MTkxOTQsIm5iZiI6MTcyNDcxODg5NCwicGF0aCI6Ii8xOTgyNTQ1NS8zMjc3NTUxMzktN2QzOGQ4YmItNzcwZC00ODcxLWEwZTktN2FhNWRjZTlkYTQ1LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI3VDAwMzQ1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJhM2IyN2U2Njc5NGU3NTlkNmY3MjJjOTQzYjMxYzc5MzhhNDMwYjY1YTFhMTJkMGRjYzA0NGVmOWJmNTlkYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.r7wGMT_2Yc4SOJ7R6aYA_vkRHZo7PfGjF1W-Vwfbo34)
The API calls are still being made - but since the results are cached, we're able to show the UI instantly. We still need to cache the APIs on the backend though.
Next steps: