feat: finalizing things#3
Open
WingsDevelopment wants to merge 1 commit into
Open
Conversation
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.
POC: Next.js Server-Side Cache
Overview
react-query sdk.vaultMetaService.fetchVerifiedVaultsfetchVerifiedVaultscache for that specific vault once fresh data arrivesResult:
Even with a long cache TTL (e.g. 1 hour), table data stays fresh over time as users visit vault detail pages or execute transactions.
Pros
Cons
(depends on cron frequency and vault popularity)
How the
/vaults(table) page worksreact-query sdk.vaultMetaService.fetchVerifiedVaultsqueryHow the vault / earn details page works
sdk.eVaultService.fetchVaultto load detailed dataBest Part
If anything goes wrong with:
…the app could automatically fall back to direct fetching. (this is not yet implemented, not sure if it would make more sense to actually always display cache even if stale, or do we allow users to try fetch themselves)
This is default React Query behavior — no extra logic or safeguards required. (right now added guard against it, to always serve the cache)