patochem
patochem
CCConvex Community
Created by patochem on 11/10/2023 in #support-community
Problems using useQuery inside a Context
I'm pretty new to React so please forgive me if what I am asking is obvious to most of you. This is the context (very simplified): - I have several tables of related elements, organized in a hierarchical way (see example below)
Main = {
countryId: GenericId<'countries'>,
cityIds: GenericId<'cities'>[],
...
}
Main = {
countryId: GenericId<'countries'>,
cityIds: GenericId<'cities'>[],
...
}
- I have a navBar on which I can select a Main object from a list. Selecting an Item gives me its ID - In my main page, I want to display the different components of a Main object (referenced by the previously selected ID), - therefore, I need to gather this data from the database (ie: the Main object, the Country referenced by the countryId and the cities references by the cityIds[]) Since I will need to use several Components to display everything, I don't want to be passing props all along and need to create a Context that wraps my page, to provide access to all the necessary info in one place. However, although the mainId wouldn't change, its countryId could change. How would I detect this change in my context and re-query the planet data for the same Main object?
8 replies
CCConvex Community
Created by patochem on 11/8/2023 in #support-community
How do I get a jwtToken from outside React
My Nextjs app is configured with convex using Clerk as an Auth provider, exactly as described in the Documentation. Everything works perfect client side, inside the React scope. However, I'd like to use a state manager outside the React scope to manage all interactions with the convex database. From the documentation, I guess I can do that with a ConvexClient. But then, how can I retrieve a valid jwt to authenticate those calls?
25 replies
CCConvex Community
Created by patochem on 11/3/2023 in #support-community
Can't import ID when using cli import feature
Hi! Congrats on Convex. It's an awesome tool! I'm trying to import data using the convex cli and json files but I need to also import the ID (I have a PK/FK situation) But doing so always throws an error :
400 Bad Request: InvalidIdError: Hit an error while importing:
Provided document ID "4q2v7830x6335s3y3r56mngm9k8bh50" doesn't match '_id' field "4m04b2em2dp8ynmntab6cz929k4m528"
400 Bad Request: InvalidIdError: Hit an error while importing:
Provided document ID "4q2v7830x6335s3y3r56mngm9k8bh50" doesn't match '_id' field "4m04b2em2dp8ynmntab6cz929k4m528"
Can someone help me regarding that?
19 replies