Closed aj-maz closed 2 years ago
LGTM! Btw @Ajand would it make sense to move this into utils ? (just curious cause data.ts seems to be growing in size)
I think it makes so much sense to make it a pure function and put it into the utils. I also needed to use this util in #526
How are we handling cache invalidation here? What happens when new grants are added to the whitelist?
@Ajand feel free to create a new issue to move to utils, or you can also update this PR
How are we handling cache invalidation here? What happens when new grants are added to the whitelist?
I haven't handled that but what's your opinion on validating whitelist objects on the filterWhiteListed helper function?
How are we handling cache invalidation here? What happens when new grants are added to the whitelist?
@gdixon It seems we always try to fetch from the whitelist URL and upon a successful fetch save the new data to the cache, so I don't think we need any additional cache invalidation behavior do we? Since it's always updated when possible + we only use as a fallback
Ahh, I misread, right you are!! 😅
rather than merging main into this branch, it's better to rebase against main (since we use the rebase workflow) - try pulling latest main and then switch to this branch and git rebase main
Whenever we fetch the whitelist I will cache it and in case of not being able to fetch the whitelist, I will use the cached one.
Also, put the fallback strategy into a new function so adding "Additionally we should add a fallback URL for the whitelist which could be a different IPFS gateway or HTTP server" must be pretty straightforward whenever the fallback URL is ready.
Suggestion: Using the cache for whitelisting while trying to fetch whitelist, will give slightly better UX with faster load time
fixed #459