룬룬이
룬룬이
CCConvex Community
Created by 룬룬이 on 9/6/2024 in #support-community
convex-ents field options default and index
I have been working on setting up my schema using convex-ents and one thing I noticed is that when I am defining a field to give it options, I cannot give it a default as well as an index. Is this intended behavior? The use case is that I would like to increment the userCount each time someone joins a community. I will have to index it to order it by userCount. However, if I don't give it a default, I'll probably end up getting an error somewhere down the road because I'll forget to give it an initial value and try to increment 1 to undefined. .field("userCount", v.number(), { default: 1, index: true })
1 replies
CCConvex Community
Created by 룬룬이 on 9/5/2024 in #support-community
Use cases for using Tanstack Query and Convex together?
I am very new to Convex so please excuse me if this is a totally obvious question as I'm trying to wrap my head around how to structure my app as I move it over to using Convex. I used Tanstack heavily for a while and the primary reason why I switched over to Convex is because I was a bit tired of managing the cache and making sure everything is real time in my highly reactive app. I've been loving Convex so far because it reduces that processes to just two steps (query -> mutation) and adding new features has become faster. I do love Tanstack query but I felt that convex could really replace most of my use cases for it. I hope this gives you a bit of a background of where I'm coming from. So, I saw that there is a Convex with Tanstack Query adapter in the docs and I wanted to ask what are the use cases of using the two together? The way I see it is that the features that are missing from Convex that are in Tanstack are the onSuccess, onError, callbacks, but I can see how I can create those as needed in my mutations. Thanks so much for helping me understand!
21 replies