acekyd / made-in-nigeria

Here is a curation of awesome tools built by Nigerians that can be used by anybody and from anywhere in the world.
https://madeinnigeria.dev
1.01k stars 401 forks source link

chore: set revalidate to false #323

Closed kaf-lamed-beyt closed 6 months ago

kaf-lamed-beyt commented 6 months ago

What does this PR do?

Fixes #315

@acekyd, I noticed that this issue was our own doing. I had to inspect the page in pro, and it refreshes every 5000ms, which was what we've asked it to do, literally.

I wondered why it worked formerly — no refreshes when it was formerly 3000ms. The only hypothesis I have now is because the former implementation wasn't extending React's cache. Now that the request in the hook is memoized, there's no need for the revalidation, I guess.

Eventually, I had to set revalidate to false.

This PR [Fixes #315

Type of change

How should this be tested?

You can check this version I deployed on netlify

Checklist

Required

Appreciated

codesandbox[bot] commented 6 months ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

netlify[bot] commented 6 months ago

Deploy Preview for made-in-nigeria-dev processing.

Name Link
Latest commit 18bbbb6ca5def927c9e7c674e9e02caf8d65ef26
Latest deploy log https://app.netlify.com/sites/made-in-nigeria-dev/deploys/661ed3ceb942050008a970cf
acekyd commented 6 months ago

Loool are you joking? @kaf-lamed-beyt 😂 Checking it out

kaf-lamed-beyt commented 6 months ago

I don't even know😂. The cache explanation is just assumption.

But, I'm pretty sure the revalidate property is definitely what's causing the refresh.

kaf-lamed-beyt commented 6 months ago

It does seem to fix it. Do you know how we should reset the cache when new projects are added to the readme then, or that should reset on build?

I think the build should reset the cache.

If there's a way to identify the cache with a key, it would have made it easier for us to reset it manually.

I don't know if it is possible with the cache module from React. But, I'll check and let you know when I find something.