question: Shouldn't we use react/cache with auth() function?
dBianchii opened this issue · comments
Gabriel Bianchi commented
Describe the feature you'd like to request
It seems like calling auth() in multiple components causes multiple requests to the database. This doesn't seem correct.
Shouldn't we export the following snipeed inside nextjs somewhere?
import { cache } from "react";
import { auth as acmeAuth } from "@acme/auth";
export const auth = cache(async () => await acmeAuth());
And then we can use it in multiple RSCs with no problem
Describe the solution you'd like to see
Additional information
Julius Marminge commented
Yes - not sure why there isnt already xd. Feel free to PR
Gabriel Bianchi commented
Gabriel Bianchi commented
Resolved by #919