15 Replies
Really cool UI!
š

This is fixed now
Nice, it's a very good example of a convex project, I just noticed that you are using ctx.runMutation and ctx.runQuery within other mutations/queries however this is better done as typescript functions as last i checked there is a performance penalty using these "subquery/mutation" calls and could cause more write conflicts as all mutations would be locked longer.
So authenticate should look more like
id also remove from authenticate, components are like "subqueries".
from the authenticate as this would hurt performance on every query also, Id cache the subscription type in the users table.
I was also curious about this, i'm not aware of any performance hits using clerk?
Hey thanks for the input
For some reason when I had the clerk check in beforeLoad on tanstack start
it created a considerable delay between page changes
I decided to only check auth on frontend
and everything loaded a lot faster
As for the polar subquery, I see what you mean but I'm not sure how to optimize that since a lot of places I need the subscription data
although I could do that in a separate util
yeah i try to always reduce the number of queries that always run from every function to 1 or 2
That makes sense
I had little to no experience with convex going into this and I'm still not too knowledgeable about it so it's good feedback
its really difficult on a convex backend that is like 50k lines lol.. but id just update users when polar updates but i havent used polar yet
oh yeah I would like to denormalize data but I want to be confident nothing get's out of sync when denormalizing
For backend auth you are sorta doing it with authenticateUser
with my clerk setup normally what i do is make a authWrapper that only checks that the user has a identity so it runs no user query.
on my more complex ents wrapped setup i have like 4 types
No auth, identity only, identity + user, identity + specific session, user, identity
so on like a userMutation i could access ctx.user and have that be whatever i want. on the session ones i can pass in various types of sessionIds to build a context for anything or it tries to level up your access as much as it can given the data it has. So for the complex setup i insert a row into a Sessions Table that is like the authentication check that the backend knows about the user. and that caches all relevant data. Any db call to a document other than ctx.auth.getUserIdentity eats bandwidth so queries can really get out of control fast I am curious if you are planning to keep adding on features to this?
so on like a userMutation i could access ctx.user and have that be whatever i want. on the session ones i can pass in various types of sessionIds to build a context for anything or it tries to level up your access as much as it can given the data it has. So for the complex setup i insert a row into a Sessions Table that is like the authentication check that the backend knows about the user. and that caches all relevant data. Any db call to a document other than ctx.auth.getUserIdentity eats bandwidth so queries can really get out of control fast I am curious if you are planning to keep adding on features to this?
I am but Iām currently trying to fix a lot of things I rushed through for the hackathon
do you want to switch it over to the agent component? I'm possibly interested in helping,
Hmm I'm not sure if that's something I want to do, I chose not to use the agent component in order to have more flexibility on the shape of threads/messages
I wasn't sure how to do that with the agent component and I was worried i would spend too much time figuring it out
Do you think it would be better to switch to the agent component?
I'm still trying to determine it myself if i need some like tool only agent requests, i plan to go as deep as possible with some agent flows well beyond a chat app. Ian is open to changing the agent component but that requires putting forth a reasonable need.
Any updates agent vs without agent comp