Commit Graph
231 Commits
Author SHA1 Message Date
Sean Oliver ad6466b1f3 feat: Add event tracking for table quickstart experiment (#39854)
* Add event tracking for table quickstart experiment

Implements telemetry instrumentation for the table quickstart experiment
to measure exposure and engagement across AI, Templates, and Assistant variations.

Events added:
- table_quickstart_viewed: Exposure tracking for variant assignment
- table_quickstart_ai_prompt_submitted: AI prompt submissions
- table_quickstart_ai_generation_completed: AI generation success/failure
- table_quickstart_template_selected: Template selection (unified for AI and templates)
- table_quickstart_quick_idea_clicked: Quick idea button clicks
- table_quickstart_category_selected: Template category navigation
- table_quickstart_assistant_opened: Assistant chat creation

All events use type-safe useTrack() hook with automatic project/org context.
Conversion tracking intentionally omitted - relying on joins with existing
table_created events for post-analysis.

* event name cleanup

* Address code review feedback

- Use nullish coalescing operator (??) instead of logical OR (||) for categoryName fallback
- Refactor handleGenerateTables to accept object parameter for improved call site readability

* prettier

* action key name alignment with event name
2025-10-28 17:12:42 +00:00
Ivan Vasilov da4a40e308 chore: Migrate RQ functions to use object syntax style (#39895)
* Migrate all uses of invalidateQueries to use object syntax.

* Migrate the remainder of useInfiniteQuery.

* Migrate all setQueriesData.

* Migrate all fetchQuery uses.

* Migrate some leftover functions from RQ.

* Fix issues found by Charis.
2025-10-28 10:43:14 +01:00
Stojan DimitrovskiandJoshen Lim 1af6b84790 types are broken (#39866)
* types are broken

* Fix TS issues

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-28 10:38:07 +08:00
Alaister YoungandJoshen Lim 8855d05803 chore(studio): swap react-query to object syntax (#39842)
* chore(studio): swap react-query to object syntax

* Fix small issues found

* Fix realtime settings

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-27 09:38:27 +01:00
Sean Oliver e05981cf2c feat: add assistant variation to table quickstart experiment (2.5 of 3) (#39825)
feat: add assistant variation to table quickstart experiment

Adds ASSISTANT variant to table quickstart that opens AI assistant with
pre-populated conversation to guide users through creating their first
database table.

Changes:
- Add QuickstartVariant.ASSISTANT enum value
- Add 'Create with Assistant' card for new projects (<7 days old)
- Implement handleOpenAssistant with proper loading states and error handling
- Add pre-populated messages to guide table creation workflow

The assistant card appears only for users bucketed into the assistant
variation of the tableQuickstart experiment on new projects.
2025-10-24 12:20:38 -07:00
Ali Waseem 0a99c0eb04 Fix: Removed default array value in case memo is broken (#39851)
Removed default array value in case memo is broken
2025-10-24 11:19:25 -06:00
Ali Waseem 31045d35fd Fix: infinite re-render on table when computing foreign keys (#39850)
fix infinite re-render on table editor
2025-10-24 10:48:59 -06:00
Sean Oliver f73ea9bd74 feat: add AI-powered table generation variant (2 of 3) (#38934)
* Add table quickstart with templates and AI generation

Implement table quickstart feature with two variants:
- Template-based: Pre-built schemas across multiple categories (social, ecommerce, content, productivity)
- AI-powered: Generate custom table schemas from natural language prompts

Key features:
- Template selector with category tabs and schema previews
- AI generation using gpt-oss-120b via Bedrock for fast response times
- Streaming responses with real-time table generation
- Quick idea chips for common use cases
- Success feedback and seamless integration with table editor
- Feature flag gated (tableQuickstart) with 7-day new project window
- Comprehensive error handling and retry logic
- ARIA labels and accessibility improvements

Technical implementation:
- Custom React hooks for AI generation and state management
- Zod schema validation for type-safe streaming
- API endpoint with structured object streaming
- localStorage-based dismissal state
- Consistent styling with existing UI patterns

* Refactor and optimize AI table generation

Refactor to use AI SDK streaming with structured object generation:
- Use streamObject() with Zod schema validation for type-safe streaming
- Add 50KB buffer limit to prevent memory issues from oversized responses
- Replace custom stream parsing with Object.assign() for efficient merging
- Use fetchHandler utility for consistent error messages across codebase
- Clean up comments and unused code

* Update quickstart widget styling to match action card

- Changed background from bg-surface-75 to bg-surface-100
- Changed hover background to bg-surface-200
- Applied to AI widget, template widget, and quick idea buttons

* Address PR review feedback

- Persist AI results to localStorage so users can create multiple tables from same generation
- Remove unnecessary isMountedRef checks before synchronous state updates
- Change Quick ideas label to semantic h4 element for accessibility
- Add TODO comment about migrating to experimental_useObject() hook

* Clean up table quickstart implementation

- Match SQL Editor ActionCard styling with circular icons
- Implement smart Generate/Regenerate button logic
- Add tooltips for column counts
- Persist prompt to localStorage
- Fix React hook dependency warnings
- Remove debugging artifacts
2025-10-23 11:35:43 -07:00
Joshen Lim 1f07439ab5 Chore/table editor stay on schema after creating table (#39758)
* Stay on schema after creating a new table if schema is not public

* Small improvement to tab closing behaviour if tab is in focused
2025-10-22 17:16:39 +08:00
Sean Oliver e1703d4429 feat: add basic table template infrastructure (1 of 3) (#38933)
* Use useLocalStorage hook for quickstart dismiss state

* Standardize varchar to text and remove local storage keys

* Remove gen_random_uuid() defaults from templates

* feat(studio): flatten table quickstart selector; show for any new table\n\n- Flattened category→template flow into single-step with category chips\n- Removed first-table-only guard so panel appears for all new tables when flag is on

* add comments to clarify diff btwn false and undefined in feature flag response type

* refactor: improve performance and type safety in table quickstart

- Memoize categories and displayed templates to prevent unnecessary re-renders
- Use generic type parameter instead of type assertion for feature flag
- Simplify dismiss handler with inline function
- Add JSDoc comment explaining feature flag return states

* Mark variant param as intentionally unused for future PR

* chore: clean up unused import in TableEditor

Remove unused useTablesQuery import after switching to localStorage-based dismissal.

* add 7 day project creation gate and fixed uuid default

* Improve table template selector UX with success feedback and clearer copy

- Add success toast when template is applied
- Update heading from "Quickstart: choose a template" to "Start faster with a table template"
- Improve subheading to explain time-saving benefit
- Use monospace font for table names to match code convention
- Update template rationales to be more descriptive and specific
- Increase font sizes for better readability
- Remove redundant category display
- Reorder imports alphabetically

* Apply prettier formatting to TableTemplateSelector
2025-10-14 16:12:36 +00:00
Alaister Young d30e4d3aa0 chore(studio): custom docs rls guide path (#39480)
* chore(studio): custom docs rls guide path

* required keys
2025-10-13 19:20:31 +08:00
Pamela Chia 5b2351da86 Add tracking for API docs usage (#39307) 2025-10-08 08:58:15 -04:00
54ad0b7495 Chore/ai realtime (#39145)
* update onboarding

* update model and fix part issue

* action orientated assistant

* fix tool

* lock

* remove unused filter

* fix tests

* fix again

* update package

* update container

* fix tests

* ai realtime

* ai realtime

* refactor(ai assistant): break out message markdown and profile picture

* wip

* refactor(ai assistant): break up message component

* refactor: break ai assistant message down into multiple files

* add limitations prompt

* limitations prompt

* link prompt

* refactor: simplify ReportBlock state

* fix: styling of draggable report block header

When the drag handle is showing, it overlaps with the block header.
Decrease the opacity of the header so the handle can be seen and the two
can be distinguished.

* fix: minor tweaks to tool ui

* refactor: simplify DisplayBlockRenderer state

* fix: remove double deploy button in edge function block

When the confirm footer is shown, the deploy button on the top right should be
hidden (not just disabled) to avoid confusion.

* refactor, test: message sanitization by opt-in level

Refactor the message sanitization to have more type safety and be more testable.
Add tests to ensure:

- Message sanitization always runs on generate-v4
- Message sanitization correctly works by opt-in level

* Fix conflicts in pnpm lock

* Couple of nits and refactors

* Revert casing for report block snippet

* adjust sanitised prompt

* Fix tests

* empty states

* prompt otpimise

* refine prompt

* prompt optimizer

* remove realtime for now

* Update apps/studio/lib/ai/prompts.ts

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/studio/lib/ai/prompts.ts

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* updates

* feature flag

* use flag and additional check

* remove sort

* messages copy

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-06 10:31:40 +10:00
Charis faa5066bdb fix(column editor): cannot read properties of null (#39244)
Another instance of types not matching reality, we have a check for undefined, but this is sometimes coming out null.
2025-10-03 16:06:42 -04:00
Sean Oliver e978a084b2 feat: add table activation tracking (#39090)
Add telemetry tracking for activation-related table operations
- Implement SQL event parser to detect table creation, data insertion, and RLS enablement
- Add telemetry tracking for these operations in table editor as well
- Add test coverage for SQL event parser
2025-10-01 14:54:51 -07:00
matlin cd6082be36 Ensure CSV chunk uploads handle rate limit 409s (#39075)
* Ensure CSV chunk uploads handle rate limit 409s

* Let executeWithRetry work with ResponseError object
2025-09-29 13:59:14 -05:00
5f533247e1 Update docs url to env var (#38772)
* Update Supabase docs URLs to use env variable

Co-authored-by: a <a@alaisteryoung.com>

* Refactor: Use DOCS_URL constant for documentation links

This change centralizes documentation links using a new DOCS_URL constant, improving maintainability and consistency.

Co-authored-by: a <a@alaisteryoung.com>

* Refactor: Use DOCS_URL constant for all documentation links

This change replaces hardcoded documentation URLs with a centralized constant, improving maintainability and consistency.

Co-authored-by: a <a@alaisteryoung.com>

* replace more instances

* ci: Autofix updates from GitHub workflow

* remaining instances

* fix duplicate useRouter

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: alaister <10985857+alaister@users.noreply.github.com>
2025-09-26 10:16:33 +00:00
matlinandCharis Lam 172f6ba5fc Improve stability and explicitness of table editor tab state syncing between URL params and local storage (#38931)
* Improve stability and explicitness of table editor tab cache <-> url syncing

* fix: maintain filter state when using nav bar to switch back to Table Editor

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-23 13:03:56 -05:00
Joshen Lim c892a7721a Fix new table button not working if on unknown table in table editor (#38891) 2025-09-22 12:14:23 +07:00
hallidayo 789af2d535 feat: show toast if table name blank (#28172)
* show toast if table name blank

* type toasts
2025-09-18 20:19:55 +00:00
Joshen Lim d46525eac1 Chore/swap use check permissions with use async check project permissions part 8 (Season Finale) (#38619)
* Update perms checking in audit logs

* Deprecate useCheckPermissions, useIsPermissionsLoaded and useCheckProjectPermissions as they're no longer used

* Rename useAsyncCheckProjectPermissions to useAsyncCheckPermissions

* Fix TS
2025-09-16 17:05:57 +08:00
Joshen Lim 466760099d Support opening table rows for foreign tables in side panel (read only) (#38699)
* Support opening table rows for foreign tables in side panel (read only)

* Fix TS
2025-09-16 11:54:03 +08:00
Joshen Lim 6a1c3390e1 Fix default value placeholder for fields with foreign keys (#38693) 2025-09-15 18:17:44 +08:00
Joshen LimandJordi Enric deda982074 Chore/refactor dashboard history logic (#38586)
* Shift dashboard history logic outside of app state, into its own hook

* Self remediate malformed history for sql editor

* Update apps/studio/hooks/misc/useDashboardHistory.ts

Co-authored-by: Jordi Enric <37541088+jordienr@users.noreply.github.com>

* Update apps/studio/hooks/misc/useDashboardHistory.ts

Co-authored-by: Jordi Enric <37541088+jordienr@users.noreply.github.com>

---------

Co-authored-by: Jordi Enric <37541088+jordienr@users.noreply.github.com>
2025-09-10 22:19:08 +08:00
Joshen Lim bc3a473170 Swap useCheckPermissions with useAsyncCheckProjectPermissions Part 6 (#38559)
More swapping
2025-09-10 11:26:26 +08:00
TaishiandCharis 9eb7b64ec4 Show an error message with a row number when a user uploads CSV file with an issue (#38422)
* change the location of importing SpreadsheetImportPreview component

* Refactor error handling in SpreadsheetImport components

- show the row number with an issue to give users more actionable message
- show only the first error since Papaparse has an issue for row value in errors array

* Refactor error message for spreadsheet import alerts

* Remove items from `results.errors` with duplicate row and code values

* add comment

* Update error badge to show dynamic issue count

* Make errors stand out

* Refactor import/export for SpreadsheetImportPreview component

* Refactor import statements for SpreadsheetImport component

* use size-[value] class

* Refactor error handling to remove duplicates in preview

* Make only items with details clickable

* use proper list element

* use `button` element for clickable items

* add transition for transform

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-09-09 22:30:23 +00:00
Joshen Lim f066c02c69 Shift refresh button to header in table editor and make realtime + API docs button smaller (#38463)
* Shift refresh button to header in table editor and make realtime button + api docs button smaller

* Fix ts
2025-09-08 14:15:39 +08:00
Taishi e5a26a9202 【CSV file import】Ensure onChange fires when the same file is uploaded twice (#38440)
Reset `event.target.value` to ensure onChange fires when the same file is uploaded twice
2025-09-05 15:35:01 +00:00
Joshen Lim a90bc51be1 Fix table editor incorrectly showing type change notice for foreign key (#38404)
* Fix table editor incorrectly showing type change notice for foreign key

* nit

* remove log
2025-09-04 15:35:36 +07:00
hallidayoandCharis Lam 25af9fa6d3 fix: add apostrophe for sql export (#37920)
* add apostrophe for sql export

* refactor: move quote escape logic to common util

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-03 16:59:18 -04:00
Joshen Lim 143ec2d54e Small style fix (#38126) 2025-08-22 20:27:40 +08:00
Joshen LimandTerry Sutton 39639a4073 chore/disable-more-sections-03 (#38060)
* Add flags for policies, third party auth, and manual linking + providers in sign in page

* Add flag for rate limitm page

* Add UnknownInterface components

* Update comment

* Flip flags to true

* Add flags for realtime policies and reports page

* Temp

* Add flag for sign in providers page

* Add flag for stripe wrapper

* Add flag for custom domains

* Add flag for dedicated ipv4 address addon

* Add empty state for realtime policies

* Add empty state for reports page

* Add flag for disable legacy JWT keys section

* Add flag for legacy jwt keys

* nit

* Remove ConnectionStringMoved call out

* Add flag for project settings log drains

* Add flag for subscription link in project settings

* Deprecate settings/auth page and redirect directly to auth page

* Flip back flags

* Add flags for account preferences analytics marketing and account deleetion

* Remove 'table_editor:enable_rls_toggle' flag and revert UI changes

* Remove 'authentication:policies' flag and revert UI changes

* Update flags

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2025-08-20 21:50:53 +08:00
Alaister YoungandJoshen Lim 33bd798d14 feat: disable database features (#38019)
* feat: disable logs features

* feat: disable project homepage features

* feat: disable org features

* Nit fixes

* reenable billing

* feat: disable database features

* Rename creation_enable_rls_toggle to just enable_rls_toggle and apply it to GridHeaderActions

* Minor nits

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-19 12:52:00 +08:00
Joshen Lim 13d264a57c Fix CSV import for postgres array types (#37995)
* Fix CSV import for postgres array types

* Add test case
2025-08-19 12:39:08 +08:00
CharisandJoshen Lim e8a19faa03 feat: drop file to import data in Table Editor (#37888)
* feat: drop file to import data

In the Table Editor for an empty table, make the entire grid area a
dropzone so that files can be dropped onto the grid area for importing.
Dropping a file opens the SpreadsheetImport side panel with the dropped
file already loaded.

* refactor: drag and drop file import

Refactor logic into hooks and utility functions

* refactor: file drop import

Small changes caught in code review

* Opt to pass file through valtio store instead of event listener

* refactor: telemetry properties + cleaning up hook deps

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-13 11:32:06 -04:00
Joshen LimandAlaister Young 7ed5edd320 Add CTA to unrestricted badge in table editor (#37730)
* Add CTA to unrestricted badge in table editor

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2025-08-12 10:44:48 +07:00
Joshen LimandDrake Costa a897cc27f0 Part 1 of swapping useCheckPermissions with useAsyncCheckProjectPermissions (#37751)
* Part 1 of swapping useCheckPermissions with useAsyncCheckProjectPermissions

* Update apps/studio/hooks/misc/useCheckPermissions.ts

Co-authored-by: Drake Costa <drake@saeris.io>

* Address feedback

---------

Co-authored-by: Drake Costa <drake@saeris.io>
2025-08-11 11:53:15 +07:00
Joshen Lim 712a6b15e6 Chore/address danny friction log (#37659)
* Standardize more icons for table editor and storage explorer

* Standardize AI perms button CTA copy

* Improve toast error copy for invalid folder name

* Storage, open folder when its created

* Highlight FileExplorerRowEditItem when there's issues with name

* Adding a new folder, remove new row if onBlur and folder name has issues

* Update tabel editor header action Auth policy -> RLS policy

* Add dialog if navigating away from custom report while there's unsaved changes

* Add cmd s shortcut to save snippet in SQL editor

* Add toggling of favorite to context menu in sql editor

* Update save query label

* Fix SqlRunButton missing prop hasSelection for SQL editor
2025-08-06 11:22:45 +07:00
Joshen LimandJordi Enric 011f6c3e87 Fix Table Editor not identifying truncated array column values properly (#37683)
* Fix Table Editor not identifying truncated array column values properly

* Add comment

* update tests

* Fix TS issues and shift test file to beside the file its testing

* Fix tests

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2025-08-06 11:11:14 +07:00
Joshen Lim cab0585533 Fe 1799/consolidate to useselectedprojectquery and (#37684)
* Replace all usage of useProjectContext with useSelectedProjectQuery

* Replace all usage of useSelectedProject with useSelectedProjectQuery

* Replace all usage of useProjectByRef with useProjectByRefQuery

* Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery

* Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks

* Deprecate ProjecContext
2025-08-06 10:53:10 +07:00
Saxon FletcherandJoshen Lim c76707012d basic typography classes (#37613)
* basic typography classes

* Clean up classes for where we use h1 tags

* Clean up classes for where we use h2, h3, h4

* Clean up classes for where we use h6

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-04 20:55:34 +10:00
Ivan VasilovandJoshen Lim b3c6992e56 feat: Make the protected schemas dynamic, namespace schemas are now protected (#37290)
* Add hooks for async protected schemas.

* Migrate the ProtectedSchemaWarning to support the new implementation.

* sq

* Migrate all uses of protected schemas to the new approach.

* Delete extra file.

* Refactor the import foreign schema dialog to forbid protected and exposed schemas.

* Add the type to the protected schema.

* Revert ImportForeignSchemaDialog, it'll be addressed in another PR.

* Update apps/studio/hooks/useProtectedSchemas.ts

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* Fix a bad commit.

* Minor fixes.

* Fix the FDW delete mutation to handle names with numbers.

* Simplify the logic to skip a fetch.

* Minor fixes.

* Make the useIcebergFdwSchemasQuery work for all iceberg FDWs.

* Fix the tab schemas to always show in the Table Editor.

* Apply suggestion from @joshenlim

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* Fix a minor typo.

* Refactor ProtectedSchemaWarning to use Admonition, and standardise input field for target schema iceberg

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-07-30 11:38:50 +02:00
Joshen Lim 9523272dbf Chore/add instructions for psql export table editor (#37249)
* Midway

* midway

* update warning

* Nit

* Nittt

* Add comment
2025-07-22 15:37:48 +08:00
Ivan Vasilov a88e89e4a8 feat: Add support for import foreign schema for wrappers (#36827)
* Add schema flag to the foreign-schema wrappers.

* Support the new mode in the create wrapper flow.

* Minor CSS tweaks.

* Re-add a missing line.

* Add source schema field.

* Make source and target schema part of the form state.

* Fix the edit mutation.

* Show a warninf for the feature if the wrappers extension is below 0.5.0.

* Bring the SchemaEditor side panel into 21st century and simplify it.

* Use the schema editor in the Create wrapper sheet to create a new schema.

* Minor fixes.

* Fix the badge border in WrapperRow.
2025-07-04 10:06:18 +02:00
Joshen Lim 327cab053a Clean up tabs interface feature flags (#36441)
* Clean up tabs interface feature flags

* Update SQL e2e test
2025-06-23 11:16:24 +08:00
Andrew ValleteauandJoshen Lim 2d0b321ec6 fix(table-editor): handle multi-dimentional array truncation and preview (#36108)
* fix(table-editor): handle multi-dimentional array truncation and preview

* fix(SidePanelEditor): fully load truncated input fields

* Small tweaks

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-06-05 10:52:47 +08:00
Joshen Lim 03dcbef16b Tiny patch table editor (#36131) 2025-06-03 15:52:13 +08:00
Alaister Young 2909965643 fix: delete row loading spinner (#36104) 2025-06-02 22:24:47 +08:00
b09440bd47 fix: move table create update delete to query route (#35662)
* fix: move table create update delete to query route

* chore: implement query to fetch a single table

* fix: retrieve table after update

* chore: assign type to update table payload

* chore: use updated table columns for edit

* chore: make executeSql castable with generic (#35685)

* Chore/refactor derivate more types from queries (#35687)

* chore: make executeSql castable with generic

* chore: derivate types from performed queries

- It allows to decouple more the frontend logic and the pg-meta/sql-query logic allowing to reduce the number of cast
and get closer types between what we do fetch and what we expect in our components

* fix: remove existing check

* chore: handle null comment and check

* fix: format check name as identifier

---------

Co-authored-by: avallete <andrew.valleteau@supabase.io>
Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
2025-05-20 10:34:59 +08:00
Joshen LimandJordi Enric bae178ace8 Fix Table Editor non-existing table state (#35710)
* Fix tabs non existent table stuck state

* Fix

* Fix

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2025-05-19 14:25:40 +00:00