joshpachner
joshpachner
CCConvex Community
Created by Clever Tagline on 9/22/2024 in #support-community
How to run multiple local-only apps that use Convex
yeah my tech stack usually consists of * vercel for hosting * supabase for db and file storage, but now might be doing more in convex * clerk for auth With all of those being able to get by on the free tier
15 replies
CCConvex Community
Created by Clever Tagline on 9/22/2024 in #support-community
How to run multiple local-only apps that use Convex
yeah of all the react-based ones out there I like Remix alot. Ive never tried Astro. This is my first time using Svelte and it fits well with Convex, because of how svelte manages state. But I only entertained the thought of learning Svelte because i knew I didnt want to use a SSR framework with convex since what I love the most about Convex is the realtime capabilities. To answer your question about the multiple local only apps. I have no idea lol. It should all be doable since convex is accessed via just APIs anyways
15 replies
CCConvex Community
Created by Clever Tagline on 9/22/2024 in #support-community
How to run multiple local-only apps that use Convex
Hey @Clever Tagline just throwing in my 2 cents here. Are you planning on using Remix as Server Side rendering or more for the SPA? I use Remix, and i Love Love it. But for my convex project I decided not to use remix because the paradigm of Convex's realtime updates and Remix being SSR just didn't mesh well with me. So, for my convex project, i decided to use Svelte. And man oh man, have i loooveed working in Svelte 5
15 replies
CCConvex Community
Created by joshpachner on 9/22/2024 in #support-community
useQuery never enters Error state
and we are using "useQuery" according to the example found here https://github.com/get-convex/convex-svelte/tree/main?tab=readme-ov-file
7 replies
CCConvex Community
Created by joshpachner on 9/22/2024 in #support-community
useQuery never enters Error state
the example found here https://docs.convex.dev/functions/error-handling/application-errors I already use elsewhere in my app. But there's no example of how to properly handle the errors from a useQuery
7 replies
CCConvex Community
Created by joshpachner on 9/22/2024 in #support-community
useQuery never enters Error state
within the getTournamentToRun function
export const getTournamentToRun = query({
args: { tournamentId: v.id("tournaments") },
handler: async(ctx, args) => {
await requireIdentity(ctx);
const tournament = await ctx.db.get(args.tournamentId);
if (tournament == null) {
throw new ConvexError("Tournament not found");
}
....
export const getTournamentToRun = query({
args: { tournamentId: v.id("tournaments") },
handler: async(ctx, args) => {
await requireIdentity(ctx);
const tournament = await ctx.db.get(args.tournamentId);
if (tournament == null) {
throw new ConvexError("Tournament not found");
}
....
7 replies
CCConvex Community
Created by joshpachner on 9/22/2024 in #support-community
useQuery never enters Error state
For more context. within my svelte file <script> tag
import { useQuery } from "convex-svelte";

const params = $page.params;
const tournamentId = params.tournamentId as Id<"tournaments">;
let group = $state("tournament");
const query = useQuery(api.tournaments.getTournamentToRun, {
tournamentId: tournamentId,
});
import { useQuery } from "convex-svelte";

const params = $page.params;
const tournamentId = params.tournamentId as Id<"tournaments">;
let group = $state("tournament");
const query = useQuery(api.tournaments.getTournamentToRun, {
tournamentId: tournamentId,
});
and then accessing the results of the query
{#if query.error}
<!-- query.error never occurs even when throwing a new ConvexError in the convex function -->
<p>Error: {query.error.toString()}</p>
{:else if query.isLoading}
<p>Loading...</p>
{:else}
<TournamentContent tournamentRun={query.data} />
{/if}
{#if query.error}
<!-- query.error never occurs even when throwing a new ConvexError in the convex function -->
<p>Error: {query.error.toString()}</p>
{:else if query.isLoading}
<p>Loading...</p>
{:else}
<TournamentContent tournamentRun={query.data} />
{/if}
7 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
because Id<"tablename"> is fundamentally just a string. And an <input type="text"> is not Id<"tablename"> rather its a string. Correct me if im wrong, but Id<"tablename"> only has importance at the time of writing to the database to enforce relationality. On the client side having to cast it to Id<"tablename"> every time its being passed doesn't actually enforce relationality. So its pointless to not just treat it as a string type.
15 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
that screenshot i sent ya is using the convex's Doc<>. And so my typescript throws a nightmare of type insecurities, because im initializing my state with an empty string (because the user has not selected the typeId yet). But using my work around causes no issues. I would recommend adding this workaround to the convex docs for otherss
15 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
That's just initializing the state (svelte app). I assume if we try to save that empty string to convex that it would then throw an error because "" is not a valid id for the TCGs table
15 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
but then that would allow it to be "nullable"
15 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
No description
15 replies
CCConvex Community
Created by joshpachner on 8/23/2024 in #support-community
Is there a way to get around the Id<"tablename">
Ok my buddy came up with something like this
import type { Doc, Id, TableNames } from "./convex/_generated/dataModel";


export type StripIds<T extends object> = {
[key in keyof T]: T[key] extends Id<TableNames> ? string : T[key];
};

export type DocStrippedWithSystemFields<T extends TableNames> =StripIds<Doc<T>>;

export type DocStripped<T extends TableNames> = Omit<DocStrippedWithSystemFields<T>, "_id" | "_creationTime">
import type { Doc, Id, TableNames } from "./convex/_generated/dataModel";


export type StripIds<T extends object> = {
[key in keyof T]: T[key] extends Id<TableNames> ? string : T[key];
};

export type DocStrippedWithSystemFields<T extends TableNames> =StripIds<Doc<T>>;

export type DocStripped<T extends TableNames> = Omit<DocStrippedWithSystemFields<T>, "_id" | "_creationTime">
15 replies
CCConvex Community
Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
you're the best! ❤️‍🔥
135 replies
CCConvex Community
Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
@siingers do you have an example of how that looks? Im in the same boat of svelte + convex + clerk
135 replies