Timeout Filtering for hasMany Relationship Data

Hey Gadget community! I'm building a dashboard where users can filter productvariants by marketingplan timeframe (e.g., "last 12 months", "next 6 months"). Need advice on the best pattern for this. Any recommendations? Use Case: Product variants have multiple monthly marketing plans User selects a timeframe filter Dashboard shows variants with their relevant marketing plans for that timeframe only Some variants may have plans outside the timeframe (should be excluded from results) Current Implementation (causing timeouts): const [{ data: variants }] = useFindMany(api.productVariant, { first: 15, filter: { marketingPlans: { some: { startDate: { greaterThanOrEqual: dateStart, lessThanOrEqual: dateEnd } } } }, select: { id: true, name: true, marketingPlans: { edges: { node: { id: true, startDate: true, budget: true, // ... other (computed) fields } } } } });
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?