flight
flight
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
thanks.. ill definitely keep that in mind
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
this is how i am calling it const { results, status, loadMore } = usePaginatedQuery(api.parts.getParts, { locationId: activeLocation as Id<'locations'>, factoryId, machineClassId, name, }, { initialNumItems: 5 });
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
Argument of type 'FunctionReference<"query", "public", { factoryId?: Id<"factories"> | undefined; machineClassId?: Id<"machineClasses"> | undefined; name?: string | undefined; locationId: Id<"locations">; paginationOpts: { ...; }; }, { ...; }[]>' is not assignable to parameter of type 'PaginatedQueryReference'. Types of property '_returnType' are incompatible. Type '{ machineClass: { _id: Id<"machineClasses">; _creationTime: number; name: string; factory: Id<"factories">; } | null; _id: Id<"parts">; _creationTime: number; factoryId: Id<"factories">; ... 4 more ...; weight: number; }[]' is missing the following properties from type 'PaginationResult<any>': page, isDone, continueCursor
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
@erquhart this is the error
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
i am confused about the calling pagination twice part
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
@erquhart id appreciate your feedback when you are less busy.... apologies for the disturbances
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
when calling it like this
const { results, status, loadMore } = usePaginatedQuery(api.parts.getParts, {
locationId: activeLocation as Id<'locations'>,
factoryId,
machineClassId,
name,
}, {
initialNumItems: 5
});
const { results, status, loadMore } = usePaginatedQuery(api.parts.getParts, {
locationId: activeLocation as Id<'locations'>,
factoryId,
machineClassId,
name,
}, {
initialNumItems: 5
});
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
im getting Types of property _returnType are incompatible.
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
but im having an issue when trying to query
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
this is what my query looks like now, i want to know if this is ideal
if (factoryId && machineClassId) {
const parts = await ctx.db
.query("parts")
.withIndex("by_locationId_factoryId_machineClassId", (q) =>
q
.eq("locationId", locationId)
.eq("factoryId", factoryId)
.eq("machineClassId", machineClassId)
)
.paginate(paginationOpts);

return Promise.all(
parts.page.map(async (part) => {
const machineClass = await ctx.db.get(part.machineClassId);
return { ...part, machineClass };
})
);
}

if (factoryId) {
const parts = await ctx.db
.query("parts")
.withIndex("by_locationId_factoryId", (q) =>
q.eq("locationId", locationId).eq("factoryId", factoryId)
)
.paginate(paginationOpts);

return Promise.all(
parts.page.map(async (part) => {
const machineClass = await ctx.db.get(part.machineClassId);
return { ...part, machineClass };
})
);
}
if (factoryId && machineClassId) {
const parts = await ctx.db
.query("parts")
.withIndex("by_locationId_factoryId_machineClassId", (q) =>
q
.eq("locationId", locationId)
.eq("factoryId", factoryId)
.eq("machineClassId", machineClassId)
)
.paginate(paginationOpts);

return Promise.all(
parts.page.map(async (part) => {
const machineClass = await ctx.db.get(part.machineClassId);
return { ...part, machineClass };
})
);
}

if (factoryId) {
const parts = await ctx.db
.query("parts")
.withIndex("by_locationId_factoryId", (q) =>
q.eq("locationId", locationId).eq("factoryId", factoryId)
)
.paginate(paginationOpts);

return Promise.all(
parts.page.map(async (part) => {
const machineClass = await ctx.db.get(part.machineClassId);
return { ...part, machineClass };
})
);
}
i cant paste the full code because discord wouldnt allow me
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
it was how to integrate it that became the issue
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
const { results, status, isLoading, loadMore } = usePaginatedQuery( api.messages.list, { channel: "#general" }, { initialNumItems: 5 } ); i already have the query you sent me...
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
yeah i did
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
on how to use the usePaginatedQuery
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
another confusing thing has to be pagination
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
@erquhart thanks as always...
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
@erquhart Hello chief, been wondering what is the quickest way to get data from an external id...for instance this query.. this query returns the machineClassId... i want to be able to get the info from the id
return ctx.db
.query("parts")
.withIndex("by_locationId", (q) => q.eq("locationId", locationId))
.collect();
return ctx.db
.query("parts")
.withIndex("by_locationId", (q) => q.eq("locationId", locationId))
.collect();
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
this is amazing.. i think i get it... you are amazing.. thanks for taking the time to explain
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
was just about to say that
77 replies
CCConvex Community
Created by flight on 5/6/2024 in #support-community
Search & filter
yeah
77 replies