React.cache security considerations for auth
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
I have got an
As I use it in multiple components / layouts and invoking it does a database call and I wanted to know whether it is okay to wrap it in React.cache so this is done only once.
As far as I understand, React.cache works on a per-request basis so this should not actually be a problem but for auth I better want to be safe. So is this problematic in any way actually?
Thank you in advance 🙂
auth()
function that can be used to get the current, user, org, etc. in RSCs.As I use it in multiple components / layouts and invoking it does a database call and I wanted to know whether it is okay to wrap it in React.cache so this is done only once.
As far as I understand, React.cache works on a per-request basis so this should not actually be a problem but for auth I better want to be safe. So is this problematic in any way actually?
Thank you in advance 🙂
1 Reply
Pacific sand lance
i used it like that, no data leak since then