Commit Graph
5 Commits
Author SHA1 Message Date
supabase-vercel-tedd[bot] e508c3c3f0 feat(studio): track schema visualizer usage (#53955)
## Problem

The schema visualizer (`/project/[ref]/database/schemas`) sends no
telemetry. We can't tell whether people use it to explore a schema or to
export it, which export format they pick, or whether they edit tables
from the graph.

## Solution

Adds PostHog events for the visualizer's main actions: changing the
schema, selecting a Find table result, copying (schema or table as
SQL/Markdown, table or column name), downloading the graph as PNG or
SVG, applying Auto layout, and choosing Edit table or Edit column from a
node menu. Each event fires from the action's handler, so actions
started from a keyboard shortcut count too. Properties are only fixed
enums (`schemaType`, `content`, `format`, `action`); no schema, table,
or column names are sent. Each tracked element also gets a `data-attr`
for autocapture. View in Table Editor and the empty state's New table
link get a `data-attr` only, because the pageview already records them.

It also fixes an empty canvas after switching back to a schema that was
already loaded. The graph stays mounted in that case and fitted the view
only on first load, so the new schema's tables could sit off-screen
until a reload. The view now fits whenever the schema on the canvas
changes. Edits within the same schema still keep the current view.

Studio's database pages keep the selected schema name in the `schema`
URL param, and that name is chosen by the customer. Telemetry now
redacts its value to `redacted` wherever it already redacts `keywords`:
the event and pageview `page_url`, the query string, the referrer,
first-touch data, and the URL properties posthog-js adds. This applies
to every Studio event and pageview, not just this page. Params that only
contain the word, such as `schemas` or `myschema`, are left alone.

## How to verify

On the PR preview, open a project's Database > Schema Visualizer with
PostHog debugging on (or watch the network requests to the telemetry
endpoint), then:

1. Change the schema in the selector: one
`database_schema_selector_updated` event with `schemaType` of `public`,
`protected` (for example `auth`), or `custom`.
2. Open Find table and select a table: one
`database_schema_visualizer_find_table_clicked` event.
3. Click Copy as SQL: one `database_schema_visualizer_copied` with
`content: 'schema_sql'`. Copy as Markdown from the export menu sends
`content: 'schema_markdown'`.
4. Download as PNG and as SVG: one
`database_schema_visualizer_image_download_clicked` each, with `format`
of `png` or `svg`.
5. Open Auto layout and click Apply: one
`database_schema_visualizer_auto_layout_applied`. Cancel sends nothing.
6. From a table node menu, choose Copy name, Copy as SQL, and Copy as
Markdown: `database_schema_visualizer_copied` with `content` of
`table_name`, `table_sql`, and `table_markdown`. Column menu Copy name
sends `column_name`.
7. From a table node menu choose Edit table, and from a column menu
choose Edit column: `database_schema_visualizer_node_menu_clicked` with
`action` of `edit_table` and `edit_column`.
8. No event carries a schema, table, or column name.
9. Switch the schema from public to auth, then back to public, with no
reload: the public tables are shown and fitted on the canvas each time.
Repeat auth → public → auth.
10. Edit a column from the graph and save: the view does not jump.
11. In the telemetry requests from steps 1 to 7 and in the pageview,
`page_url` and `ph.search` show `schema=redacted`, never the schema
name. The page itself still shows and switches the real schema.

## Checks

Ran `pnpm turbo run typecheck --filter='...[origin/master]'`. Every
package passed except studio, which ran out of memory beside a parallel
lint run. `pnpm --filter studio run typecheck` alone then passed, and
passed again after the view fix. `pnpm turbo run lint
--filter='[origin/master]'` ran out of memory twice on studio's
`lint:type-checks` (2 GB default heap). So I ran `eslint` and `eslint
--config eslint.type-checks.config.cjs` on the changed Studio files with
a larger heap: no errors, only pre-existing warnings. `vitest run
components/interfaces/Database/Schemas/Schemas.utils.test.ts` passed.
For the redaction, `vitest run` in `packages/common` (all 310 tests,
including the new `schema` cases) and its `typecheck` passed; `common`
has no lint script. `oxfmt --check` passes on all changed files. Event
names and properties follow the repo's `telemetry-standards` skill.

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] The change is scoped to one feature
- [x] Events are defined in `packages/common/telemetry-constants.ts` and
added to the `TelemetryEvent` union

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5031](https://linear.app/supabase/issue/FE-5031/track-usage-on-the-schema-visualizer).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-25 11:35:03 +00:00
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00
Danny White 476d4a5851 refactor(ui): drop redundant Button variant="default" props (#50161)
## What kind of change does this PR introduce?

Mechanical cleanup on top of the Button default-variant change (#50160).

## What is the current behavior?

Many callsites still pass `variant="default"` even though that is now
the component default.

## What is the new behavior?

Removes redundant static `variant="default"` from legacy `Button` and
`ButtonTooltip` callsites. Keeps explicit defaults where they document
the API:

- `button-default.tsx` and `button-sizes.tsx` demos
- `DocsButton`, which pins neutral styling at the wrapper boundary

## To test

Studio:

- [Auth → Rate
Limits](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/auth/rate-limits):
dirty the form so Cancel appears; Cancel stays neutral, Save stays green
- [Project Settings → API
Keys](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/settings/api-keys):
`DocsButton` in the header actions stays neutral

Design system:

- [Design system →
Button](https://design-system-git-dnywh-dc924ac1-supabase.vercel.app/design-system/docs/components/button):
`button-default` / `button-sizes` still show explicit default styling;
Primary (green) is restricted to the Primary section (and `asChild`)

WWW:

- [www → Brand
assets](https://zone-www-dot-com-git-dnywh-dc924ac1-supabase.vercel.app/brand-assets):
Download logo kit / Download button kit stay neutral
2026-09-11 17:05:26 +10:00
Gildas GarciaandIvan Vasilov 96d43099bb chore: refactor Button API so that it can be used a standard button (#46880)
## Problem

Our `<Button>` component breaks the default `button` contract by
redefining the `type` prop to set its variant (`primary`, `default`,
etc) instead of the button type (`submit`, `button`, etc).
This is confusing and forces to write more code when using it with
shadcn components that expect/inject the standard button props.

## Solution

- rename the `type` prop to `variant`
- rename the `htmlType` prop to `type`
- propagate the changes where necessary
- format code

## How to test

As this is just prop renaming, if it builds it's ok

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-06-16 23:59:58 +02:00
Charis a4334a2cc7 feat(studio): paginate Schema Designer via useInfiniteTablesQuery (#46402)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Performance improvement / feature

## What is the current behavior?

The Schema Designer fetches all tables in a single request via
`useTablesQuery`. For schemas with 400+ tables this blocks first paint
on a large payload.

## What is the new behavior?

`SchemaGraph` uses `useInfiniteTablesQuery` (pageSize: 100) so the first
100 tables paint immediately. A "Load more tables" button appears above
the legend whenever more pages remain, letting users load the rest on
demand.

## Additional context

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a "Find table…" selector and keyboard shortcut to quickly locate
and focus tables; supports incremental loading and debounced name search
(with literal wildcard handling).
* Schema Graph shows a bottom "Load more tables" control with loading
state and preserves view after loading more.

* **Refactor**
* Table listing switched to infinite/paginated retrieval and improved
"no tables" logic; server-side name filtering supported.

* **Tests**
* E2E tests add a schema-visualizer wait helper and update flows to
support the paginated visualizer.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46402?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-29 15:12:22 -04:00