Mathias
CCConvex Community
•Created by Mathias on 9/22/2024 in #support-community
How to do something on a specific date or time?
I'm wondering if it is possible to do something on a specific date or time. For instance, I have a taskboard in my app where I can set a due date. I would like to add to a table if the date is either near, on date or past date.
I was looking at scheduled functions, but I couldn't figure out if that could lookup a value in the database and then do the function?
3 replies
CCConvex Community
•Created by Mathias on 8/20/2024 in #support-community
How to upload images using Convex storage? (Solved)
I'm wondering if anyone has played around using Convex storage for their text editors?
I'm using the Novel.sh package, and they are providing an uploadFn like this:
I have stripped it down to get rid of the Vercel blob storage implementation, and though I would use the uploadstuff.dev, but I really struggle to make it work within the onUpload. It does not seem to run the following lines:
If I run the console.log, I get the following:
So it would seem that the
onUpload
is running but not the Convex specific functions. What have I missed?2 replies
CCConvex Community
•Created by Mathias on 8/17/2024 in #support-community
How to fix Uncaught Error: Not authenticated?
When I reload the page within my app, I get this error message in the Convex logs within the dashboard:
This isthe getUser query:
The query does seem to work, as I am logged in to the app. Is there a loading step to add to the query, so the error doesn't show unless the identity is in fact missing?
3 replies
CCConvex Community
•Created by Mathias on 8/17/2024 in #support-community
How to use skip in my useStableQuery?
I wonder if I can use
skip
using my useStableQuery, when args are not present. The reason I got to think about it was when I realised that I got a lot of similar logs like this one within Convex dashboard:
I then tried something like this:
This is my useStableQuery:
How can I make sure I conditionally query when args are present?4 replies
CCConvex Community
•Created by Mathias on 8/8/2024 in #support-community
How to implement sort by reordering items in a list?
I'm about to implement sorting in a table, where I would like to use either Framer motion or Atlassian Pragmatic drag and drop.
Has anyone experience with mutations and how this can be done? This is the schema for what I want to sort by the
order
column.
Framer motion reorder seems to do it by index and using states. I would like to avoid states if possible and do mutations directly.
What do you think is a good way to do this?4 replies
CCConvex Community
•Created by Mathias on 7/9/2024 in #support-community
Queries and best practices: How to query multiple tables and return object?
I have a few queries, that seems very large in terms of lines of code, and I was wondering if there is a better way to do this. This example is a get query to get multiple tables to then end up returning one object with a lot of information:
See the code example here as Discord doesn't allow longer messages:
https://stackoverflow.com/questions/78727640/queries-and-best-practices-how-to-query-multiple-tables-and-return-object-using
An example of my flow table:
So, I essentially want to get the status, priority and type of the flow returned in the same object.
I heard about the query
convex-helpers/react
but I'm not sure if that can be of any help. I was also wondering of abstracting some of the logic to other files and then importing them where I'm going to use it, is a good idea?7 replies
CCConvex Community
•Created by Mathias on 6/11/2024 in #support-community
How to fix Uncaught Error: Not found
I have this getTeams query:
I receive this error when no teams can be found where the user is also a member.
How can I solve this?
6 replies
CCConvex Community
•Created by Mathias on 5/4/2024 in #support-community
How to prevent re-rendering using useMutation?
I'm using a Sheet component from Shadcn/ui in my Next.js project.
Currently, the Sheet "closes" automatically whenever there are changes to statuses, assignees, etc. This behavior appears to be linked to the use of useMutation because if I disable the mutation, the Sheet remains open during these changes. I need the Sheet to stay open even while data changes via mutations.
It appears that the issue is present either using useState from React or when using Zustand.
Is there a method to prevent the Sheet from auto-closing when the mutation is executed?
11 replies
CCConvex Community
•Created by Mathias on 3/26/2024 in #support-community
How to group tasks by their column?
I'm trying to group tasks by their respective column by doing a Map(), but I get the following error:
Uncaught Error: Map[] is not a supported Convex type.
This is what I have tried:
I would like to end up with data like this:
So I can render it like this:
5 replies
CCConvex Community
•Created by Mathias on 3/10/2024 in #support-community
How to query and filter with multiple arguments?
I'm trying to query workspaceMembers, where both userId and workspaceId are true. I tried below but it returned null:
I also tried with
withIndex
but it seems you can only use one. What is a good way to query with multiple arguments for filtering or indexing?
Update:
I got the following to work for my use case, but I'm still not sure if that is the most efficient or correct way to do it:
3 replies
CCConvex Community
•Created by Mathias on 3/9/2024 in #support-community
How to call a function within another function?
I would like to get an id from another function, instead of providing the id via args. My use case is that I want to get all users from a group using the current users activeGroupId.
This query gives me the Id that I need:
Now, I don't know how to use it in my query to get all members. This is the current code, where the groupId is an empty string, which is the one I want to get replaced by the output of getActiveSpace:
Can you point me in towards a ressource or help me what I missed to get it to work? There might also be a simpler solution.
6 replies
CCConvex Community
•Created by Mathias on 3/9/2024 in #support-community
Query all users based on an Id
I'm working on optimizing a data query process in our application and could use your insight. Currently, I'm faced with a rather inefficient method of fetching all users associated with a specific group. The process involves multiple steps: initially querying for a user to determine their 'activeGroup' and then using this identifier to fetch the group and its associated users. This approach seems overly cumbersome and I'm convinced there must be a more direct and efficient method.
To give you a clearer picture, here's how our data is structured:
User Document Example:
Group Document Example:
My goal is to simplify this process, ideally querying for all users within a specific group directly, without the preliminary steps currently required. I'm searching for any resources or advice you may have on achieving this more effectively. Do you know of any methods or tools that could facilitate a more streamlined approach to querying these relationships?
Thanks in advance for your help!
8 replies