fawwaz
fawwaz
CCConvex Community
Created by fawwaz on 11/3/2023 in #support-community
ways to debug and fix slow updates
No description
3 replies
CCConvex Community
Created by fawwaz on 10/24/2023 in #support-community
Trying to implement 404 but getting validator error
No description
15 replies
CCConvex Community
Created by fawwaz on 10/15/2023 in #support-community
an object with fixed shape but random keys in the table schema
I wanted to ask if it possible to have in the table schema an object with fixed shape but random keys of type string. For example how do represent the below type as table schema. type TableSchema = { name: string; data: { [key: string]: { value: string; }; }; }; Currently the only way I know how to do this, is to set data to type any which can be very annoying as the object get more complex.
3 replies
CCConvex Community
Created by fawwaz on 10/11/2023 in #support-community
How to use react-email & Resend to send email through convex action
No description
38 replies
CCConvex Community
Created by fawwaz on 9/18/2023 in #support-community
ReferenceError: structuredClone is not defined
Seems I can't use structuredClone inside convex, but according to my convex tsconfig, there shouldn't be a problem, right?
{
/* This TypeScript project config describes the environment that
* Convex functions run in and is used to typecheck them.
* You can modify it, but some settings required to use Convex.
*/
"compilerOptions": {
/* These settings are not required by Convex and can be modified. */
"allowJs": true,
"strict": true,

/* These compiler options are required by Convex */
"target": "ESNext",
"lib": ["ES2021", "dom"],
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "Node",
"isolatedModules": true,
"noEmit": true,
"paths": {
"@domainLayer/*": ["../src/domain-layer/*"],
"@/*": ["../src/*"],
"@convex/*": ["./*"]
}
},
"include": ["./**/*", "../src/components/email"],
"exclude": ["./_generated"]
}
{
/* This TypeScript project config describes the environment that
* Convex functions run in and is used to typecheck them.
* You can modify it, but some settings required to use Convex.
*/
"compilerOptions": {
/* These settings are not required by Convex and can be modified. */
"allowJs": true,
"strict": true,

/* These compiler options are required by Convex */
"target": "ESNext",
"lib": ["ES2021", "dom"],
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "Node",
"isolatedModules": true,
"noEmit": true,
"paths": {
"@domainLayer/*": ["../src/domain-layer/*"],
"@/*": ["../src/*"],
"@convex/*": ["./*"]
}
},
"include": ["./**/*", "../src/components/email"],
"exclude": ["./_generated"]
}
3 replies
CCConvex Community
Created by fawwaz on 9/16/2023 in #support-community
Cannot find module error when deploying to Vercel
No description
3 replies
CCConvex Community
Created by fawwaz on 9/12/2023 in #support-community
convex dev server can take up to minute to update, what can I do?
No description
18 replies
CCConvex Community
Created by fawwaz on 9/9/2023 in #support-community
getUserIdentity from inside a query
hey all 👋 , I have a query that is in a component wrapped in an auth gate. the Auth gate checks for authentication status and only then does it render the component with the query. However, looking at the logs, it looks like the query fires twice once the query handler can get the user Identity through ctx.auth.getUserIdentity but another time calling ctx.auth.getUserIdentity return null. here is my auth gate component
const AuthGateProps: React.FC<AuthGatePropsProps> = ({ children }) => {
const { isAuthenticated, isLoading } = useConvexAuth();
if (isLoading) {
return <div>Loading...</div>;
}

if (!isAuthenticated) return <div>Not authenticated</div>;
console.log({ isAuthenticated });
return <Authenticated>{children}</Authenticated>;
};
const AuthGateProps: React.FC<AuthGatePropsProps> = ({ children }) => {
const { isAuthenticated, isLoading } = useConvexAuth();
if (isLoading) {
return <div>Loading...</div>;
}

if (!isAuthenticated) return <div>Not authenticated</div>;
console.log({ isAuthenticated });
return <Authenticated>{children}</Authenticated>;
};
and the code for the query handler
export const get = query({
args: {
id: v.id("campaigns")
},
handler: async (ctx,args) => {
const userIdentity = await ctx.auth.getUserIdentity()
console.log("$$$userIdentity", userIdentity);
if(!userIdentity){
throw new Error("userIdentity not found")
}
export const get = query({
args: {
id: v.id("campaigns")
},
handler: async (ctx,args) => {
const userIdentity = await ctx.auth.getUserIdentity()
console.log("$$$userIdentity", userIdentity);
if(!userIdentity){
throw new Error("userIdentity not found")
}
3 replies
CCConvex Community
Created by fawwaz on 9/8/2023 in #support-community
getting user currently active organization and metadata with clerk auth?
Hello all 👋 , I tried to follow the documentations to setup clerk with convex and got it working, however, the token data doesn't not include currently active organization nor the user metadata. is there is a working example on how to do that?
14 replies
CCConvex Community
Created by fawwaz on 8/13/2023 in #support-community
building realtime table similar to notion tables
Hey al 👋 , so inspired by Notion and LiveBlocks I wanted to create a realtime table. My idea was that the state, as well as the mutation will be in store similar to how redux works. For hydration and persistence I wanted to build an store enhancer to handle this similar to the approach of the (LiveBlocks-Redux integration)[https://liveblocks.io/docs/api-reference/liveblocks-redux] which will fire an update mutation on every state change. However, because reactive queries in Convex is only accessable through query hooks and hooks can't be used in a store enhancer since it's not a component nor a hook. My question is, is there is away to work around this issue, to build a realtime table. Currently the custom hook powering the notion table looks like this
function useNotionTable(initialState?: NotionTableState) {
const tableState = { ...defaultState, ...initialState };
const includeTitle = tableState.columns.find((column) => column.type === "title");
if (!includeTitle) {
tableState.columns.push({
id: "title",
type: "title",
header: "Title",
accessorKey: "title",
columnConfigs: {
options: [],
},
});
}
const [state, dispatch] = useReducer(tableReducer, tableState);

return {
state,
dispatch: (action: NotionTableAction) => {
dispatch(action);
},
};
}
function useNotionTable(initialState?: NotionTableState) {
const tableState = { ...defaultState, ...initialState };
const includeTitle = tableState.columns.find((column) => column.type === "title");
if (!includeTitle) {
tableState.columns.push({
id: "title",
type: "title",
header: "Title",
accessorKey: "title",
columnConfigs: {
options: [],
},
});
}
const [state, dispatch] = useReducer(tableReducer, tableState);

return {
state,
dispatch: (action: NotionTableAction) => {
dispatch(action);
},
};
}
5 replies
CCConvex Community
Created by fawwaz on 7/31/2023 in #support-community
Parameter has a name but no type
No description
5 replies