fix(dashboards): guard convex query and refine empty state CTA
This commit is contained in:
parent
fb17882dad
commit
38651ca706
2 changed files with 8 additions and 3 deletions
|
|
@ -462,10 +462,11 @@ export function DashboardBuilder({ dashboardId, editable = true, mode = "edit" }
|
|||
const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
|
||||
const viewerId = convexUserId as Id<"users"> | null
|
||||
const canEdit = editable && Boolean(viewerId) && isStaff
|
||||
const hasDashboardId = typeof dashboardId === "string" && dashboardId.length > 0
|
||||
|
||||
const detail = useQuery(
|
||||
api.dashboards.get,
|
||||
viewerId
|
||||
viewerId && hasDashboardId
|
||||
? ({
|
||||
tenantId,
|
||||
viewerId: viewerId as Id<"users">,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue