vini
vini
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
thanks for helping and sure I'm looking to further use it so I'll be checking any updates 😁
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
seems like any interaction with geospatial will log this warning, so if you're saying the code looks ok I could just ignore it for now
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
here
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
am I doing it wrong?
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
hmm this is the helper function
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
No description
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
also, these warns only happens on my local terminal (when running npx convex dev), there are no warns in my project logs
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
this is routes.ts
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
my bad, routes is the current file and it's also a table in my db
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
updated the code to use my helper function but there's no internal.routes, with internal it seems I can access any internalMutation, internalAction or internalQuery
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
since it's still in beta, could be a minor issue from the lib?
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
"@convex-dev/geospatial": "^0.1.7",
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
yes, here
// convex/index.ts
import { Id } from "@/convex/_generated/dataModel";
import { GeospatialIndex } from "@convex-dev/geospatial";
import { components } from "./_generated/api";

export const geospatial = new GeospatialIndex<Id<"routes">>(
components.geospatial,
);
// convex/index.ts
import { Id } from "@/convex/_generated/dataModel";
import { GeospatialIndex } from "@convex-dev/geospatial";
import { components } from "./_generated/api";

export const geospatial = new GeospatialIndex<Id<"routes">>(
components.geospatial,
);
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
34 replies
CCConvex Community
Created by vini on 2/7/2025 in #support-community
Cannot solve "Convex functions should not directly call other Convex functions"
// convex/routes.ts

import { geospatial } from "@/convex";
import { internal } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";
import { action, internalMutation, query } from "@/convex/_generated/server";
import { coordinateSchema, routeSchema } from "@/convex/schema";
import { v } from "convex/values";
import * as Routes from "./model/routes";

export const insertRouteMutation = internalMutation({
args: {
...routeSchema,
},
handler: async (ctx, data) => Routes.insertRoute(ctx, data),
});

export const insertGeospatialPointMutation = internalMutation({
args: {
routeId: v.id("routes"),
point: coordinateSchema,
},
handler: async (ctx, { routeId, point }) =>
Routes.insertGeospatialPoint(ctx, routeId, point),
});

export const createRouteWithPointsAction = action({
args: {
...routeSchema,
points: v.array(coordinateSchema),
},
handler: async (ctx, { points, ...route }) => {
console.log(points.length);
const routeId: Id<"routes"> = await ctx.runMutation(
internal.routes.insertRouteMutation,
route,
);

// UPDATED LINE
await Routes.insertManyGeospatialPoints(ctx, routeId, points);

return routeId;
},
});
// convex/routes.ts

import { geospatial } from "@/convex";
import { internal } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";
import { action, internalMutation, query } from "@/convex/_generated/server";
import { coordinateSchema, routeSchema } from "@/convex/schema";
import { v } from "convex/values";
import * as Routes from "./model/routes";

export const insertRouteMutation = internalMutation({
args: {
...routeSchema,
},
handler: async (ctx, data) => Routes.insertRoute(ctx, data),
});

export const insertGeospatialPointMutation = internalMutation({
args: {
routeId: v.id("routes"),
point: coordinateSchema,
},
handler: async (ctx, { routeId, point }) =>
Routes.insertGeospatialPoint(ctx, routeId, point),
});

export const createRouteWithPointsAction = action({
args: {
...routeSchema,
points: v.array(coordinateSchema),
},
handler: async (ctx, { points, ...route }) => {
console.log(points.length);
const routeId: Id<"routes"> = await ctx.runMutation(
internal.routes.insertRouteMutation,
route,
);

// UPDATED LINE
await Routes.insertManyGeospatialPoints(ctx, routeId, points);

return routeId;
},
});
34 replies
CCConvex Community
Created by Chad Maycumber on 5/2/2023 in #support-community
GEO JSON queries
I really really appreciate this and will try it out today in a side project. I've been really enjoying using convex and been convincing some friends and clients to try it. Thanks a lot!!
53 replies