-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix(website): caching of transparency page #495
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@@ -26,7 +39,12 @@ export default async function Page(props: TransparencyPageProps) { | |||
<Stats.Stat.Item variant="value">{contributionStats.totalContributions}</Stats.Stat.Item> | |||
</Stats.Stat> | |||
</Stats> | |||
<TransparencyCharts contributionStats={contributionStats} paymentStats={paymentStats} {...props} /> | |||
<TransparencyCharts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you realize that this is the absolute crucial change?
Without this change, the caching doesn't work. But with this change, it doesn't matter if you leave the getStats()
function in a separate file, wrap it inside a cache()
call, or specify export const revalidate = 3600;
. All these things don't matter in this case. All that matters for the caching to work is to not use the spread (...) operator on the page props. I'm so confused 🤯. I guess it's never a good idea to use ...props
with page components.
Obviously, specifying export const revalidate = 3600;
makes sense; otherwise the stats are never updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I only now saw your comment from above🙈😅 I'll merge the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool! Thanks a lot for looking into this. I don't really understand what the issue was before with using the spread operator (see my comment), but at least it works now :)
@mkue Like this, it works for me. It seems to me, that providing the
TransparencyPageProps
to theTransparencyCharts
is causing the reevaluation ofgetStats
in each request. Something in there makes the caching obsolete. Providing the parameters explicitly, the caching and reevaluation seems to work fine.