FleetAdmiralJakob 🗕 🗗 🗙
FleetAdmiralJakob 🗕 🗗 🗙
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/29/2024 in #support-community
Is Uploadstuff recommend for use or should I use plain Convex?
2 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/28/2024 in #support-community
[Convex Ents](bug): One to many edge with weird type
my schema looks like that
const schema = defineEntSchema({
// other ents

messages: defineEnt({})
// some fields
.edges("reactions", { ref: true })
// some edges
}),

reactions: defineEnt({})
// some fields and edges
.edge("message"),
});
const schema = defineEntSchema({
// other ents

messages: defineEnt({})
// some fields
.edges("reactions", { ref: true })
// some edges
}),

reactions: defineEnt({})
// some fields and edges
.edge("message"),
});
and I'm querying the data like that:
await message.edge("reactions"),
await message.edge("reactions"),
but as a type I get this back
(property) reactions: Ent<"reactions", {
_id: Id<"reactions">;
_creationTime: number;
emoji: string;
userId: Id<"users">;
messageId: Id<"messages">;
}, EntDataModelFromSchema<SchemaDefinition<{
privateChats: EntDefinition<VObject<{
support: boolean;
}, {
...;
}, "required", "support">, {}, {}, {}, {
...;
} & ... 1 more ... & {
...;
}>;
users: EntDefinition<...>;
clearRequests: EntDefinition<...>;
messages: EntDefinition<...>;
reactions: EntDefinition<...>;
}, true>>>[]
(property) reactions: Ent<"reactions", {
_id: Id<"reactions">;
_creationTime: number;
emoji: string;
userId: Id<"users">;
messageId: Id<"messages">;
}, EntDataModelFromSchema<SchemaDefinition<{
privateChats: EntDefinition<VObject<{
support: boolean;
}, {
...;
}, "required", "support">, {}, {}, {}, {
...;
} & ... 1 more ... & {
...;
}>;
users: EntDefinition<...>;
clearRequests: EntDefinition<...>;
messages: EntDefinition<...>;
reactions: EntDefinition<...>;
}, true>>>[]
which makes me get reactions with edge, edgeX and doc which I dont want but I only want this type (without edge, edgeX and doc)
(property) reactions: Ent<"reactions", {
_id: Id<"reactions">;
_creationTime: number;
emoji: string;
userId: Id<"users">;
messageId: Id<"messages">;
}, & EntInstance<EntDataModelFromSchema<SchemaDefinition<...>>, "reactions">
(property) reactions: Ent<"reactions", {
_id: Id<"reactions">;
_creationTime: number;
emoji: string;
userId: Id<"users">;
messageId: Id<"messages">;
}, & EntInstance<EntDataModelFromSchema<SchemaDefinition<...>>, "reactions">
3 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/24/2024 in #support-community
Upgrade from 1.17.0 to 1.17.2: Error: Could not find Convex client!
I upgraded my project that had no errors whatsoever from 1.17.0 to 1.17.2 and now get this error:
Error occurred prerendering page "/sign-in". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Could not find Convex client! `ConvexQueryCacheProvider` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app
Error occurred prerendering page "/sign-in". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Could not find Convex client! `ConvexQueryCacheProvider` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app
These are my providers: layout.tsx
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body
className={cn(
GeistSans.className,
"min-h-screen bg-background antialiased",
)}
>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<ClerkProvider dynamic>
<ConvexClientProvider>
<ConvexQueryCacheProvider>{children}</ConvexQueryCacheProvider>
</ConvexClientProvider>
</ClerkProvider>
</ThemeProvider>
</body>
</html>
);
}
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body
className={cn(
GeistSans.className,
"min-h-screen bg-background antialiased",
)}
>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<ClerkProvider dynamic>
<ConvexClientProvider>
<ConvexQueryCacheProvider>{children}</ConvexQueryCacheProvider>
</ConvexClientProvider>
</ClerkProvider>
</ThemeProvider>
</body>
</html>
);
}
convex-client-provider.tsx
"use client";

import { useAuth } from "@clerk/nextjs";
import { env } from "~/env";
import { makeUseQueryWithStatus } from "convex-helpers/react";
import { useQueries } from "convex-helpers/react/cache/hooks";
import { ConvexReactClient } from "convex/react";
import { ConvexProviderWithClerk } from "convex/react-clerk";
import { type ReactNode } from "react";

const convex = new ConvexReactClient(env.NEXT_PUBLIC_CONVEX_URL);

export const useQueryWithStatus = makeUseQueryWithStatus(useQueries);

export default function ConvexClientProvider({
children,
}: {
children: ReactNode;
}) {
return (
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
{children}
</ConvexProviderWithClerk>
);
}
"use client";

import { useAuth } from "@clerk/nextjs";
import { env } from "~/env";
import { makeUseQueryWithStatus } from "convex-helpers/react";
import { useQueries } from "convex-helpers/react/cache/hooks";
import { ConvexReactClient } from "convex/react";
import { ConvexProviderWithClerk } from "convex/react-clerk";
import { type ReactNode } from "react";

const convex = new ConvexReactClient(env.NEXT_PUBLIC_CONVEX_URL);

export const useQueryWithStatus = makeUseQueryWithStatus(useQueries);

export default function ConvexClientProvider({
children,
}: {
children: ReactNode;
}) {
return (
<ConvexProviderWithClerk client={convex} useAuth={useAuth}>
{children}
</ConvexProviderWithClerk>
);
}
I never had this error. It just happened while trying to upgrade.
25 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/20/2024 in #support-community
Preload query does not work with dynamicIO
No description
3 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/20/2024 in #support-community
Bug: Can't preload a page with pagination
No description
18 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/20/2024 in #support-community
Is there a way to enforce and check all my envs at build / deploy time?
Similar to how I can use https://env.t3.gg for Next.js
4 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 11/18/2024 in #support-community
Docs on mobile have weird break points
No description
5 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 10/27/2024 in #support-community
[Convex + Clerk + Next.js] Cant make static routes
No description
7 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 8/18/2024 in #support-community
Manually make requests
I have an open websocket connection to convex. How can I manually (not through code) make a request to my convex backend?
6 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 8/17/2024 in #support-community
[Convex Ents] Asymmetrical self-directed 1:many edges
Is that possible with Convex Ents? doesnt see it in the docs. Point is that I want a reply functionality. Which means that there is one message that replies to another (asymmetrical) but you can only reply to one message. But one message can be replied to by many messages.
26 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/24/2024 in #support-community
Git annoyance
No description
5 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/22/2024 in #support-community
Convex Query is called multiple times even in production build
No description
5 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/19/2024 in #support-community
data privacy mode
I want to build an app where every data stored in Convex needs to be treated very carefully and ideally cant even be seen by the owner of the program (us/me). Is there a mode where I can't access the production data only the users? The other option would be to encrypt it manually.
8 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/18/2024 in #support-community
[Optimistic Updates] ArgumentValidationError: Value does not match validator.
I get with my implementation of the optimistic updates this error:
Error: [CONVEX M(messages:markMessageRead)] [Request ID: c6981e014a16ba01] Server Error
ArgumentValidationError: Value does not match validator.
Path: .messageId
Value: "5b234bb4-ce93-46d7-add3-448b90a09be9"
Validator: v.id("messages")

Called by client
Error: [CONVEX M(messages:markMessageRead)] [Request ID: c6981e014a16ba01] Server Error
ArgumentValidationError: Value does not match validator.
Path: .messageId
Value: "5b234bb4-ce93-46d7-add3-448b90a09be9"
Validator: v.id("messages")

Called by client
Code (I quadruple-checked it, and it has no type errors):
const sendMessage = useMutation(
api.messages.createMessage,
).withOptimisticUpdate((localStore, args) => {
const chatId: Id<"privateChats"> = args.chatId as Id<"privateChats">;
const content = args.content;

const existingMessages = localStore.getQuery(api.messages.getMessages, {
chatId,
});
const existingChats = localStore.getQuery(api.chats.getChats);
// If we've loaded the api.messages.list query, push an optimistic message
// onto the list.
if (existingMessages !== undefined && existingChats && userInfo) {
const now = Date.now();
const newMessage: FunctionReturnType<
typeof api.messages.getMessages
>[number] = {
userId: undefined,
_id: crypto.randomUUID() as Id<"messages">,
_creationTime: now,
content,
deleted: false,
privateChatId: chatId,
from: userInfo,
readBy: [userInfo],
};
localStore.setQuery(api.messages.getMessages, { chatId }, [
...existingMessages,
newMessage,
]);
localStore.setQuery(
api.chats.getChats,
{},
existingChats.map((chat) => {
if (chat._id === chatId) {
return {
...chat,
lastMessage: {
...newMessage,
userId: userInfo._id,
},
};
} else {
return chat;
}
}),
);
}
});
const sendMessage = useMutation(
api.messages.createMessage,
).withOptimisticUpdate((localStore, args) => {
const chatId: Id<"privateChats"> = args.chatId as Id<"privateChats">;
const content = args.content;

const existingMessages = localStore.getQuery(api.messages.getMessages, {
chatId,
});
const existingChats = localStore.getQuery(api.chats.getChats);
// If we've loaded the api.messages.list query, push an optimistic message
// onto the list.
if (existingMessages !== undefined && existingChats && userInfo) {
const now = Date.now();
const newMessage: FunctionReturnType<
typeof api.messages.getMessages
>[number] = {
userId: undefined,
_id: crypto.randomUUID() as Id<"messages">,
_creationTime: now,
content,
deleted: false,
privateChatId: chatId,
from: userInfo,
readBy: [userInfo],
};
localStore.setQuery(api.messages.getMessages, { chatId }, [
...existingMessages,
newMessage,
]);
localStore.setQuery(
api.chats.getChats,
{},
existingChats.map((chat) => {
if (chat._id === chatId) {
return {
...chat,
lastMessage: {
...newMessage,
userId: userInfo._id,
},
};
} else {
return chat;
}
}),
);
}
});
9 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/15/2024 in #support-community
Convex Ents with Optimistic Updates
No description
6 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/15/2024 in #support-community
Scroll to top button over convex chat ai bot
No description
1 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/6/2024 in #support-community
Convex mutation inside tanstack/react query mutation
I want to do crazy browser push api stuff. For this I want to abstract a function inside a tanstack query mutation this tanstack mutation has to call the convex mutation. (it has to make a db write and a bunch of extra stuff) Is that possible with the convex mutation?
20 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/3/2024 in #support-community
Use Node only for specific actions
No description
15 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/3/2024 in #support-community
Pass whole db entry into action
Hi, I want to pass a whole user object and message object into my action. How can I do that? I mean: How do I write the args for that?
11 replies
CCConvex Community
Created by FleetAdmiralJakob 🗕 🗗 🗙 on 6/2/2024 in #support-community
[Convex Ents] ctx in mutation does not have a runMutation or runQuery function
Hi, I currently have my mutation defined as:
export const mutation = customMutation(
baseMutation,
customCtx(async (ctx) => {
return {
table: entsTableFactory(ctx, entDefinitions),
db: undefined,
};
}),
);
export const mutation = customMutation(
baseMutation,
customCtx(async (ctx) => {
return {
table: entsTableFactory(ctx, entDefinitions),
db: undefined,
};
}),
);
and the ctx object of this does not have a function called runMutation or runQuery to call a internal mutation or query as defined here: https://docs.convex.dev/functions/internal-functions#calling-internal-functions
6 replies