t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native

Home Page:https://turbo.t3.gg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question: Shouldn't we use react/cache with auth() function?

dBianchii opened this issue · comments

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

Yes - not sure why there isnt already xd. Feel free to PR

Resolved by #919