scallop-io / sui-scallop-sdk

This is the typescript sdk for the scallop lending platform on SUI network
Apache License 2.0
29 stars 9 forks source link

feat: add tanstack query to reduce rpc requests and api requests #66

Closed fum-is-chum closed 6 months ago

fum-is-chum commented 7 months ago
fum-is-chum commented 7 months ago

@mr-donor Can you explain further about the invalidation cache problem more detail here? Because I did not encounter any cache invalidation problem, and actually no need to call the invalidate cache function

mr-donor commented 7 months ago

@mr-donor Can you explain further about the invalidation cache problem more detail here? Because I did not encounter any cache invalidation problem, and actually no need to call the invalidate cache function

Can you explain why no need to call the invalidate cache function?

I used the optimized SDK to test on the dapp last time, and it had the problem that the cache could not be updated after portfolio and coins updated. What I mean is that once we added caching to the sdk, we should help users handle the caching more accurately.

fum-is-chum commented 7 months ago

@mr-donor Can you explain further about the invalidation cache problem more detail here? Because I did not encounter any cache invalidation problem, and actually no need to call the invalidate cache function

Can you explain why no need to call the invalidate cache function?

I used the optimized SDK to test on the dapp last time, and it had the problem that the cache could not be updated after portfolio and coins updated. What I mean is that once we added caching to the sdk, we should help users handle the caching more accurately.

The reason is because the default staleTime for DEFAULT_CACHE_OPTIONS is only 3s, so the cache will be marked as stale after 3s and the cache will be invalidated query will be refetched automatically on the next call. Unless we set the staleTime to a longer duration or Infinity, then we need to manually call the cache invalidation function