From eff3316480553da8d37be82147c474278263adab Mon Sep 17 00:00:00 2001 From: Matiss Jurevics Date: Tue, 3 Feb 2026 18:59:55 +0000 Subject: [PATCH] feat: Add `by_owner` index to the projects table, remove redundant query filter, and update `isAuthenticated` export. --- convex/projects.ts | 3 +-- convex/schema.ts | 2 +- docs/changelog.md | 12 ++++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/convex/projects.ts b/convex/projects.ts index 0f03dc0..4b57282 100644 --- a/convex/projects.ts +++ b/convex/projects.ts @@ -9,8 +9,7 @@ export const getProjects = query({ if (!userId) return []; return await ctx.db .query("projects") - .withIndex("by_owner", (q) => q.eq("userId", userId)) // Note: Need to add index to schema too? Or just filter? Schema doesn't define indexes yet. Will rely on filter for now or filter in memory if small. Actually, will rely on simple filter or add index later. - .filter((q) => q.eq(q.field("userId"), userId)) + .withIndex("by_owner", (q) => q.eq("userId", userId)) .collect(); }, }); diff --git a/convex/schema.ts b/convex/schema.ts index 0b9284a..a3bccda 100644 --- a/convex/schema.ts +++ b/convex/schema.ts @@ -11,7 +11,7 @@ const schema = defineSchema({ dorkingConfig: v.object({ selectedSourceIds: v.array(v.id("dataSources")), }), - }), + }).index("by_owner", ["userId"]), dataSources: defineTable({ projectId: v.id("projects"), type: v.literal("website"), diff --git a/docs/changelog.md b/docs/changelog.md index 849876a..ca9f424 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,15 @@ 2026-02-03 16:43:46 - Fixed 'NoAuthProvider' error by adding Password provider to `convex/auth.config.ts`. 2026-02-03 16:46:52 - Added Google OAuth provider to `convex/auth.config.ts` to fix 'Provider google is not configured' error. 2026-02-03 17:05:00 - Exported 'isAuthenticated' from 'convex/auth.ts' to fix missing export error. +## 2026-02-03 18:54:04 - Fixed convex-auth isAuthenticated export + +- Updated `convex/auth.ts` to export `isAuthenticated` directly from `convexAuth()` as required by convex-auth 0.0.76+ +- Removed manual fallback query for `isAuthenticated` +- Cleaned up unused imports (`getAuthUserId`, `query`) + + +- Ran `npx convex dev --once` to regenerate Convex API types and sync the new `isAuthenticated` export + +- Added missing `by_owner` index on `userId` to the `projects` table in `convex/schema.ts` +- Removed redundant `.filter()` call in `convex/projects.ts` getProjects query +