šŸ“„ SKILL.md

← Vault

name: comercialrs-settings-debugging

description: Debugging Settings page tabs and conditional rendering in ComercialRS

category: browser-debugging


ComercialRS Settings Page - Debugging Conditional Tabs

Common Issue

The "AutomaƧƵes" tab in /settings only renders when !isPreSales:

`tsx

{!isPreSales && (

AutomaƧƵes

)}

`

If the user can't see the AutomaƧƵes tab, isPreSales is evaluating to true for their profile — even if their profiles.role shows "admin".

Debug Steps

1. Check profile role directly via Management API:

`bash

curl -s -X POST 'https://api.supabase.com/v1/projects/{ref}/database/query' \

-H 'Authorization: Bearer {pat}' \

-H 'Content-Type: application/json' \

-d '{"query": "SELECT profiles.id, profiles.user_id, profiles.role, auth.users.email FROM profiles JOIN auth.users ON profiles.user_id = auth.users.id;"}'

`

2. Check user_roles table for the user:

`bash

curl -s -X POST 'https://api.supabase.com/v1/projects/{ref}/database/query' \

-H 'Authorization: Bearer {pat}' \

-H 'Content-Type: application/json' \

-d '{"query": "SELECT * FROM user_roles WHERE user_id = '\''{user_id}'\'';"}'

`

3. In browser console, try clicking the tab directly:

`javascript

document.querySelector('[role="tab"][value="automations"]')?.click()

// or

document.querySelector('[role="tab"]:nth-of-type(5)')?.click()

`

Browser Tool Gotchas