alixiA
Convex Community2y ago
4 replies
alixi

Public/private function duplication

I’m often finding myself writing two versions of the same function: a public one with a user guard (using convex-helpers custom functions) and an internal one where i pass the user identity in using the arguments. i’ve just been extracting out the handler function so i can use it in both functions, but it’s a lot of boilerplate code and it’s sometimes annoying to have to refactor a bunch of public functions after i realize i also want to call them internally. i was wondering if anyone else has this experience or has any suggestions for a nice way to deal with it?
Was this page helpful?