too_easy
too_easy
CCConvex Community
Created by too_easy on 1/13/2025 in #support-community
How does convex provide for multi region?
that's ok we can live with it for now, as we are working on a beta, next year though we'd need more speed. Super keen to see things through with convex, been following since you guys spun up and its awesome to be using it in a proper application now, so we'll be sticking around, just this will be a blocker 12months from now
4 replies
CCConvex Community
Created by patamembrillo on 11/28/2024 in #support-community
Convex + Tanstack Start + Clerk
Calling client.mutation(api.doSomething) will now have access to the auth context properly, so no need to pass around userId
20 replies
CCConvex Community
Created by patamembrillo on 11/28/2024 in #support-community
Convex + Tanstack Start + Clerk
Convex + Clerk + Start is working neatly for us - although setup was tedious at first. I've found this setup at __root works consistently, the other way in the docs was causing issues tbh
function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
const [{ convex, queryClient }] = useState(() => {
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL);
const convexQueryClient = new ConvexQueryClient(convex);
const queryClient = new QueryClient({
defaultOptions: {
queries: {
queryKeyHashFn: convexQueryClient.hashFn(),
queryFn: convexQueryClient.queryFn(),
},
},
});

convexQueryClient.connect(queryClient);

return {
convex,
queryClient,
};
});

return (
<ClerkProvider>
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
<QueryClientProvider client={queryClient}>
<html>
<head>
<Meta />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
</QueryClientProvider>
</ConvexProviderWithClerk>
</ClerkProvider>
);
}
function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
const [{ convex, queryClient }] = useState(() => {
const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL);
const convexQueryClient = new ConvexQueryClient(convex);
const queryClient = new QueryClient({
defaultOptions: {
queries: {
queryKeyHashFn: convexQueryClient.hashFn(),
queryFn: convexQueryClient.queryFn(),
},
},
});

convexQueryClient.connect(queryClient);

return {
convex,
queryClient,
};
});

return (
<ClerkProvider>
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
<QueryClientProvider client={queryClient}>
<html>
<head>
<Meta />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
</QueryClientProvider>
</ConvexProviderWithClerk>
</ClerkProvider>
);
}
Then we create a http client to use in server functions like this:
export const createConvexClient = async () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const CONVEX_URL = import.meta.env.VITE_CONVEX_URL!;

if (!CONVEX_URL) {
console.error("missing env CONVEX_URL");
}

const { getToken } = await getAuth(getWebRequest());
const token = await getToken({ template: "convex" });

const client = new ConvexHttpClient(CONVEX_URL);

if (token) {
client.setAuth(token);
}

return client;
};
export const createConvexClient = async () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const CONVEX_URL = import.meta.env.VITE_CONVEX_URL!;

if (!CONVEX_URL) {
console.error("missing env CONVEX_URL");
}

const { getToken } = await getAuth(getWebRequest());
const token = await getToken({ template: "convex" });

const client = new ConvexHttpClient(CONVEX_URL);

if (token) {
client.setAuth(token);
}

return client;
};
20 replies
CCConvex Community
Created by too_easy on 11/26/2024 in #support-community
[Resolved] - TypeError: Cannot destructure property 'signIn' of useAuthActions
Resolved - but only god knows why.. 🤦‍♂️
6 replies
CCConvex Community
Created by too_easy on 11/26/2024 in #support-community
[Resolved] - TypeError: Cannot destructure property 'signIn' of useAuthActions
No description
6 replies
CCConvex Community
Created by too_easy on 11/26/2024 in #support-community
[Resolved] - TypeError: Cannot destructure property 'signIn' of useAuthActions
compilerOptions: {
"rootDir": ".",
"baseUrl": ".",
/* Standardised modules */
"moduleResolution": "Bundler",
"module": "ESNext",
"target": "ESNext",
/* General rules across the repo */
"allowJs": true,
"strict": true,
"skipLibCheck": true,
"strictNullChecks": true,
"allowSyntheticDefaultImports": true,
"isolatedModules": true,
}
compilerOptions: {
"rootDir": ".",
"baseUrl": ".",
/* Standardised modules */
"moduleResolution": "Bundler",
"module": "ESNext",
"target": "ESNext",
/* General rules across the repo */
"allowJs": true,
"strict": true,
"skipLibCheck": true,
"strictNullChecks": true,
"allowSyntheticDefaultImports": true,
"isolatedModules": true,
}
6 replies
CCConvex Community
Created by too_easy on 11/26/2024 in #support-community
[Resolved] - TypeError: Cannot destructure property 'signIn' of useAuthActions
Also does not work with setting {ssr: false} on the createFileRoute function
6 replies
CCConvex Community
Created by too_easy on 11/25/2024 in #support-community
How to use convex in a big team/monorepo
Let's say we have several domains (e.g. org, billing, orders, templates etc..), each domain would have several tables, and subsets of functions e.g. org.team.workspaces.createWorkspace() - here the org (organisation domain) has a teams table, workspaces table, with a function to create a workspace for a team. Where as orders might be orders.fulfilment.getShipping() - has orders table, fulfilment table and shipping functions.. how best to organise something similar (in concept).
14 replies
CCConvex Community
Created by too_easy on 11/25/2024 in #support-community
How to use convex in a big team/monorepo
Thanks for the fast reply - ok that's pretty cool. In terms of having multiple convex instances is that a thing? Or can you suggest how to split up the convex folder/functions/schema for multiple domains - I'm really not a fan of having a single schema.ts file
14 replies