Samuel
@samuel.fm
Ok putting revalidate: 3600 on the createSession call should fix it I think. Means that the session token will be always less than an hour old. However, seems a little wasteful since I only want to revalidate when the other one needs revalidating
Samuel@samuel.fm· 25 Sept 2023
Next 13 people - how can I group multiple fetch caches together. I need to fetch the session token before fetching posts - how do I make sure it doesn’t use a stale token without completely getting rid of the cache
2 4
Samuel
My understanding is that the getPosts call is run at build time. So actually revalidating the token all the time is a waste of time
1
Samuel
Could I wrap both calls in a cache perhaps? Struggling to find other people talking about this issue
1
Orual
Yeah I was wondering the same. Don't like wasting packets on failing to get a thing and then having to refresh the token, then get a thing again, and don't like that it's not clear how long the accessJwt token lasts in practice.
2 3
Samuel
It’s worse than that because getPosts is only run once at build time, and now there’s a serverless function spinning up every hour to get a new session token to do… nothing
2
Orual
Right, makes sense that the info is in the token. Kinda annoyed that I didn't think of that.
2