rutenisraila
rutenisraila•17mo ago

query invalidation not working with multiple indexes

Hi guys, I've been experimenting with multiple indexes and I've noticed I'm able fetch the data by them just fine, but when I do a delete/add mutation the data stays the same. It does refresh after a full page reload. I'm attaching a query example: export const getByDecisionId = query({ args: { decisionId: v.id('decisions'), }, handler: async (ctx, args) => { if ( !args.decisionId) { return null; } const identity = await ctx.auth.getUserIdentity(); if (identity === null) { return null; } return await ctx.db .query('options') .withIndex('by_decision_id_and_user_token', (q) => q.eq('decisionId', args.decisionId).eq('userTokenIdentifier', identity.tokenIdentifier) ) .collect(); }, }); on the other hand, when combining multiple filters like in the example below, the UI updates after a delete/add mutation. export const getByDecisionId = query({ args: { decisionId: v.id('decisions'), }, handler: async (ctx, args) => { if ( !args.decisionId) { return null; } const identity = await ctx.auth.getUserIdentity(); if (identity === null) { return null; } return await ctx.db.query('options') .filter((q) => q.eq(q.field('decisionId'), args.decisionId)) .filter((q) => q.eq(q.field('userTokenIdentifier'), identity.tokenIdentifier)) .collect(); }, });
7 Replies
sujayakar
sujayakar•17mo ago
hi @rutenisraila, thanks for reporting! we've identified the issue and will have it fixed shortly. we'll update the thread here once it's resolved.
rutenisraila
rutenisrailaOP•17mo ago
thanks for a quick response! @sujayakar
presley
presley•17mo ago
@rutenisraila Can you confirm if you can still observe the issue?
rutenisraila
rutenisrailaOP•17mo ago
now it seems like I can't get any options at all. They do appear in the Convex dashboard, but the types and data seems to be not syncing to my code. I restarted convex dev server. Could be that I missed something so attaching some screenshots
No description
No description
No description
No description
No description
rutenisraila
rutenisrailaOP•17mo ago
I see the schema is not visible so attaching the full screenshot for reference
No description
presley
presley•17mo ago
Are you missing a return statement? in getByDecisionId
rutenisraila
rutenisrailaOP•17mo ago
💀 you're right, seems like it works with indexes now!

Did you find this page helpful?