refactor: use Convex skip sentinel in query args
This commit is contained in:
parent
3de7eccaa8
commit
bd2f22d046
32 changed files with 167 additions and 157 deletions
|
|
@ -29,14 +29,14 @@ export function CsatReport() {
|
|||
const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
|
||||
const enabled = Boolean(isStaff && convexUserId)
|
||||
const data = useQuery(
|
||||
enabled ? api.reports.csatOverview : undefined,
|
||||
api.reports.csatOverview,
|
||||
enabled
|
||||
? ({ tenantId, viewerId: convexUserId as Id<"users">, range: timeRange, companyId: companyId === "all" ? undefined : (companyId as Id<"companies">) })
|
||||
: undefined
|
||||
: "skip"
|
||||
)
|
||||
const companies = useQuery(
|
||||
enabled ? api.companies.list : undefined,
|
||||
enabled ? { tenantId, viewerId: convexUserId as Id<"users"> } : undefined
|
||||
api.companies.list,
|
||||
enabled ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip"
|
||||
) as Array<{ id: Id<"companies">; name: string }> | undefined
|
||||
|
||||
if (!data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue