DylanDev
DylanDev
CCConvex Community
Created by DylanDev on 12/20/2024 in #support-community
Deleting Users from Backend Function that are Synced with Clerk
Are you supposed to declare a clerkClientInstance inside of every action or should I declare that at the very top of the .ts file to be used everywhere
11 replies
CCConvex Community
Created by DylanDev on 12/20/2024 in #support-community
Deleting Users from Backend Function that are Synced with Clerk
Thank you for your help!
11 replies
CCConvex Community
Created by DylanDev on 12/20/2024 in #support-community
Deleting Users from Backend Function that are Synced with Clerk
@Tom thank you tom! I ended up splitting the code into a mutation and an action. That way I could use the third party call inside of the backend!
11 replies
CCConvex Community
Created by DylanDev on 11/7/2024 in #support-community
npx convex deploy does not send my dev data including files to production
Awesome thank you!
4 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
ill look into it thank you so much!
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
@sshader @FleetAdmiralJakob 🗕 🗗 🗙 alright i see
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
i think using meta data in clerk would be fine but im trying to decide
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
i just need something simple where each user can have stats stored about them
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
Ah i see
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
@FleetAdmiralJakob 🗕 🗗 🗙 Have you used clerk before? Are you at all expierenced with messing with it from the backend
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
ah okay
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
im just a little bit confused on how to implement this
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
@FleetAdmiralJakob 🗕 🗗 🗙 So do I have to have a httpAction api function that my other function calls?
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
Thank you 👑
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
ah okay
26 replies
CCConvex Community
Created by DylanDev on 10/14/2024 in #support-community
Clerk With Convex in Backend Functions
are you able to provide me with any documentation? I was having trouble finding info on it
26 replies
CCConvex Community
Created by DylanDev on 10/8/2024 in #support-community
Supposed to return ids in random order but mostly does one image
how do i not cache them?
7 replies
CCConvex Community
Created by DylanDev on 10/8/2024 in #support-community
Supposed to return ids in random order but mostly does one image
No description
7 replies
CCConvex Community
Created by DylanDev on 10/8/2024 in #support-community
Supposed to return ids in random order but mostly does one image
import { api } from "@/convex/_generated/api";
import { useQuery } from "convex/react";
import React, { createContext, useState, useEffect, useContext } from "react";
import { Id } from "@/convex/_generated/dataModel";

interface GameContextType {
levels: Id<"levels">[];
currentRound: number;
score: number;
currentLevelId: Id<"levels"> | null;
currentImageSrcUrl: string;
}

const GameContext = createContext<GameContextType | null>(null);

export const GameProvider = ({
children
}: {
children: React.ReactNode;
}) => {
const [levels, setLevels] = useState<Id<"levels">[]>([]);
const [currentRound, setCurrentRound] = useState(0);
const [score, setScore] = useState(0);
const [currentLevelId, setCurrentLevel] = useState<Id<"levels"> | null>(null);
const [currentImageSrcUrl, setCurrentSrcUrl] = useState("")

const ids = useQuery(api.game.getRandomLevels);
const imageSrc = useQuery(api.game.getImageSrc, currentLevelId ? { id: currentLevelId } : "skip");

useEffect(() => {
if (ids) {
setLevels(ids);
setCurrentRound(1);
setCurrentLevel(ids[0]);
}
}, [ids]);

useEffect(() => {
if(currentLevelId) {
setCurrentSrcUrl(imageSrc ?? "");
}
}, [currentLevelId, imageSrc]);

if (ids === undefined || (currentLevelId && imageSrc === undefined)) {
// The query is still loading
/**
* TODO: Add skeleton here @Daniel
*/
return <div>Loading...</div>;
}

return (
<GameContext.Provider value={{ levels, currentRound, score, currentLevelId, currentImageSrcUrl }}>
{children}
</GameContext.Provider>
);
};

// Export the hook so that components can use game context
export const useGame = () => useContext(GameContext);
import { api } from "@/convex/_generated/api";
import { useQuery } from "convex/react";
import React, { createContext, useState, useEffect, useContext } from "react";
import { Id } from "@/convex/_generated/dataModel";

interface GameContextType {
levels: Id<"levels">[];
currentRound: number;
score: number;
currentLevelId: Id<"levels"> | null;
currentImageSrcUrl: string;
}

const GameContext = createContext<GameContextType | null>(null);

export const GameProvider = ({
children
}: {
children: React.ReactNode;
}) => {
const [levels, setLevels] = useState<Id<"levels">[]>([]);
const [currentRound, setCurrentRound] = useState(0);
const [score, setScore] = useState(0);
const [currentLevelId, setCurrentLevel] = useState<Id<"levels"> | null>(null);
const [currentImageSrcUrl, setCurrentSrcUrl] = useState("")

const ids = useQuery(api.game.getRandomLevels);
const imageSrc = useQuery(api.game.getImageSrc, currentLevelId ? { id: currentLevelId } : "skip");

useEffect(() => {
if (ids) {
setLevels(ids);
setCurrentRound(1);
setCurrentLevel(ids[0]);
}
}, [ids]);

useEffect(() => {
if(currentLevelId) {
setCurrentSrcUrl(imageSrc ?? "");
}
}, [currentLevelId, imageSrc]);

if (ids === undefined || (currentLevelId && imageSrc === undefined)) {
// The query is still loading
/**
* TODO: Add skeleton here @Daniel
*/
return <div>Loading...</div>;
}

return (
<GameContext.Provider value={{ levels, currentRound, score, currentLevelId, currentImageSrcUrl }}>
{children}
</GameContext.Provider>
);
};

// Export the hook so that components can use game context
export const useGame = () => useContext(GameContext);
This is where i call the functions
7 replies
CCConvex Community
Created by DylanDev on 10/7/2024 in #support-community
How to find a table entry from _id
No description
6 replies