Commit Graph
39 Commits
Author SHA1 Message Date
4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Ivan VasilovandJoshen Lim 9fa96977be chore: Minor prettier fixes (#43849)
This PR fixes some prettier issues:
- Bump and unify all prettier versions to 3.7.3 across teh whole repo
- Bump the SQL prettier plugin
- When running `test:prettier`, check `mdx` files also
- Run the new prettier format on all files

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-03-17 11:17:42 +01:00
Francesco Sansalvadore bd9e78b209 chore: dashboard header alignments (#42769)
Align borders to match header heights.

<img width="2904" height="1734" alt="shot_2026-02-04_at_08 42 21z_2x"
src="https://github.com/user-attachments/assets/0538f8eb-64a5-4329-94fb-3ea4feed847d"
/>
2026-02-13 11:48:12 +01:00
Pamela Chia b6d8f2ae2d chore: remove tableQuickstart and realtimeButtonVariant experiments (#42388)
## Summary

Removes two concluded A/B experiments that didn't produce positive
results:
- **tableQuickstart**: Tested AI-powered table generation, template
selection, and assistant integration for new table creation
- **realtimeButtonVariant**: Tested hiding the realtime button or
replacing it with a triggers button

## Changes

- Delete `TableQuickstart/` folder with AI widget, templates widget, and
generation hooks
- Delete `useRealtimeExperiment` hook and remove variant-conditional
logic
- Delete `/api/ai/table-quickstart/generate-schemas` endpoint
- Remove telemetry event definitions for both experiments
- Remove local storage exposure tracking key
- Remove API endpoint from proxy whitelist
- Clean up eslint baseline references

## Testing

- [x] Tested locally - Table Editor renders correctly without experiment
widgets
- [x] TypeScript compiles without errors
- [x] No remaining references to removed experiment code

**Quick test:**
1. Navigate to Table Editor → New Tab shows only "Create a table" card
(no AI/Templates/Assistant variants)
2. Open table create panel → Realtime checkbox shows unconditionally
when realtime is enabled

## Linear

fixes GROWTH-609

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

* **Removed Features**
* AI-powered table generation and quickstart assistance (templates, AI
widget, generation hook, templates data, and related utilities)
  * Quickstart templates widget and predefined table templates
  * Database triggers management interface
  * Realtime experiment gating and related experiment variants

* **API & Storage**
  * Hosted AI quickstart API endpoint removed
  * Local storage key for quickstart exposure tracking removed

* **Telemetry**
  * Quickstart- and realtime-experiment telemetry events removed

* **UI Changes**
  * Simplified realtime toggle control in the table editor
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-03 11:55:10 +08:00
kemal.earth e36b5fe70b feat(studio): scroll sql editor tabs to end when longer than container width (#42218)
* feat: scroll sql editor tabs to end when longer than container width

* feat: more fine tuned

* feat: code clean up into hook

* chore: run prettier

* fix: remove remnant of old useEffect
2026-01-28 14:21:33 +00:00
kemal.earth e284e5ddcd fix(studio): table editor sidebar toggle on mobile (#41894)
fix: table editor sidebar toggle on mobile
2026-01-15 08:44:08 +00:00
Francesco Sansalvadore a65c661270 fix(studio): remove mobile sidebar toggle in table editor (#41914)
fix(studio): remove redundant sidebar toggle in table editor
2026-01-15 14:30:51 +07:00
Sean OliverandJoshen Lim 4e9b718cf3 Fix table quickstart experiment multi-bucket exposure issue (#41423)
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-01-09 15:53:12 -08:00
Ivan VasilovandJoshen Lim a36b65e7a3 fix: Refactor all Table Editor links to include sorts and filters (#41075)
* Possible solution with building the URL from local storage.

* Refactor the local storage for tabs to use table ids.

* Fix the saving table state to local storage.

* Minor fixes.

* Open the correct schema when following the link.

* Minor fixes from CodeRabbit.

* Address charis' feedbacks

* Clean

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-18 10:21:09 +01:00
Ivan VasilovandJoshen Lim 5fb5acc0b9 chore: Refactor the generation of ids for snippets (#41264)
* Add a generateDeterministicUuid function and tests for it.

* Use the new function and generate an id automatically when creating a snippet.

* Clean up extra code.

* Don't pass in id when creating a snippet.

* Add generateSnippetTitle function and use it instead of fixed string.

* When SQL editor is open, generate an id form a generated snippet title.

* Add id override for SQL editor to avoid flash when saving the snippet.

* Merge the two generate functions to happen in the same useMemo block.

* Save the snippet to the API when adding it.

* Minor fixes from CodeRabbit review.

* Hide new folder CTA in sql editor for self-hosted

* Don't add the snippet for saving, just set the value.

* UpsertContentPayload always has an id.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-16 09:43:59 +01:00
Marouane SoudaandAli Waseem e1f758ad40 fix(editor): correct 'Close to the Right' behavior when invoked on inactive tab (#40709)
fix(editor): correct 'Close to the Right' behavior when invoked on inactive tabs

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-24 08:24:25 -07:00
Marouane SoudaandAli Waseem b12d68fd9d fix(studio): show 'Expand sidebar' on tooltip when sidebar is closed (#40491)
Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-19 17:07:47 +00:00
Yazan Amer Abu ObaidehandAli Waseem ef2027f61a fix: #38830 (#38856)
Check whether schema is protected when setting table editor actions

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-14 10:34:16 -07:00
Sean OliverandCopilot c52e8b53aa Fix table_quickstart_opened event to track control group (#39986)
* Fix table_quickstart_opened event to track control group

Previously, the control group was excluded from exposure tracking because
activeQuickstartVariant filtered out CONTROL variants. This prevented
establishing a baseline for A/B test analysis.

Changes:
- Add shouldTrackExposure variable to separate tracking from rendering logic
- Track all variants including control when conditions are met
- Add explicit type narrowing for TypeScript safety
- Update comment to document control as valid variant

The event now fires for all users in the experiment (including control)
when viewing NewTab on projects < 7 days old in table editor mode.

* Update apps/studio/components/layouts/Tabs/NewTab.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-29 13:38:45 -06:00
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
738c568e6b Sidebar manager (#39795)
* sidebar-manager

* storage keys

* tests

* more ai spots

* test fix

* revert to default

* remove ref

* Update apps/studio/state/sidebar-manager-state.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix ts

* fix

* fux

* fux query param

* clean

* fix

* more

* mock local storage

* simplify

* remove provider test

* remve useopensidebar

* fix(new homepage): open ai assistant on advisor card button clicks

* Update apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx

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

* Update apps/studio/state/sidebar-manager-state.tsx

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

* refine

* FIX

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-10-28 10:07:21 +10: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
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
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 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 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
Joshen Lim 73e6bdf1b6 Address Sentry issue (#38364)
* Address https://supabase.sentry.io/issues/6826153016

* Address https://supabase.sentry.io/issues/6785459028
2025-09-02 10:41:14 +07: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
Jordi Enric 22ca812f56 fix tabs crash (#37875) 2025-08-12 20:24:43 +02: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 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 efaf4d5183 Chore/new sql (#37579)
* just redirect to new on sql empty

* clean up

* update template and quickstarts link

* Nit clean up

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-01 17:03:34 +08: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
Greg Richardson 1a064fef70 feat: middle click closes tab (#37187) 2025-07-16 14:20:39 +08: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
Joshen Lim c665e0b25a Add context menu to Tabs Interface for closing tabs (#36192) 2025-06-06 10:24:38 +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
Alaister Young 22db2c323e chore: refactor tabs store (#35551)
* chore: refactor tabs store

* remove tabs from local storage when disabling preview
2025-05-15 11:42:18 +08:00
Joshen Lim 2066e1c652 Set up to default opt in tabs interface (#35549)
* Set up to default opt in tabs interface

* Add callout in new tab

* Unify tabs feature flag
2025-05-13 20:07:40 +08:00
Joshen Lim 270935bec8 Chore/update tab labels when entering sql or table editor (#35219)
* Update table editor tab labels when entering table editor if labels dont match entity names

* Update sqlEditorTabsCleanup to also update tab labels if they dont match snippet names

* Update table editor tabs clean up logic to be consistent with sql editgor

* Clean up
2025-04-29 11:15:29 +08:00
Joshen Lim 58a9db9db5 Chore/fix searching in table editor clearing tabs (#35198)
* Fix searching in table editor clears tabs

* Clean

* clean

* Make close button slightly bigger
2025-04-22 17:33:21 +07:00
143f49414b Feat/tabs (#31071)
* init

* Update inner-side-menu.mdx

* chore: update SQL sidebar to use ui pattern components

* mor

* Update

* Update index.tsx

* init: merge table editor and sql editor and schema visualization together

* more

* move to valtio

* fix issue with Command+B shortcut

* now shows in treeviews if item is opened in tab

* Update ProjectLayout.tsx

* fix sidebar

* fix schema selector for non explorer version

* show schema name in tabs

* added schema names to tabs

* tabs have been updated to support preview tabs

* fix URL issue

* add empty state stuff

* Update SQLEditorNav.tsx

* preview tab works now

* more tabs stuff. 'new' tab also added

* new tab concept

* updates

* fix type errors

* remove unused files

* update test

* move back button, fix width issues on sidebar

* update sidebar logic

* Update ProjectLayout.tsx

* lots of updates. layouts now streamlined. localstorage for tabs in use

* moar

* bunch of new tab logic

* fix empty tab issue

* Update tabs.ts

* layouts switched

* new pages now have fixed layouts

* fix tabs

* fix code bg

* add tabs support for multiple project refs

* intialization issue

* update ID handling

* fixed isOpened state for SQL snippets

* remove old assistant because its bugging up panels

* preview style works in sql editor

* fix border

* removes preview tab if there is one

* fix background of loading skeleton

* lots of issues with types/icons/redirect

* new tab cards

* snippets in empty state now work

* moar stuff

* tabs now in feature flags

* Update tabs.ts

* Update tabs.ts

* moar

* add feature previews

* remove code not needed

* Update next-env.d.ts

* Delete FeaturePreviewModal.tsx

* fix typescript errors. remove more explorer stuff

* remove explorer files

* fixed issues with templates and quickstarts tab

* fixed active state when tabs are not opted in

* logic error

* fix open/highlight issue when opted out of tabs

* templates/quickstarts now displayed with new cards

* Update recent-items.tsx

* Update new-tab.tsx

* add icon back in

* add old empty state back in

* recent items updated to respect project ref

* localstorage cleanup on deletion

* moar

* overflow tabs now working

* correct tab names used for new sql templates/quickstarts

* ongoing queries fix

* cleanup

* update images

* Update RouteValidationWrapper.tsx

* Update AppLayout.tsx

* Update NavigationBar.tsx

* add headers back into side panels

* improve writing

* tabs now drag and drop a billion times better

* Update tabs.tsx

* Update tabs.tsx

* init issues on stores, which caused a race condition.

* fix hydration error

* fix new tab issue in sql

* Update ProjectLayout.tsx

* Update pnpm-lock.yaml

* Update new-tab.tsx

* move EditorMenuListSkeleton

* Fix type issues

* fixes: DESIGN-87

fixes: DESIGN-87

* refactor sort/filter components

* Update rules-set-button-text.tsx

* remove discussions for now

* small styling fixes

* Update FeaturePreviewModal.tsx

* Update FeaturePreviewModal.tsx

* Update RouteValidationWrapper.tsx

* revert

* revert

* revert

* revert

* revert

* more revert

* Update collapse-button.tsx

* Update SQLEditorTreeViewItem.tsx

* revert

* Update SchemaGraph.tsx

* Delete new-upcoming.tsx

* revert

* Update ProjectLayout.tsx

* fix home link

* Update table-editor.spec.ts

* test update

* Update table-editor.spec.ts

* Fix the playwright tests.

* layout fixes

* layout fix

* revert sort/filter

* Update LastSignInWrapper.tsx

* revert

* revert

* remove

* update file names

* revert

* revert

* revert

* Fix TreeView console error props

* Add guards in SQL Editor to ensure that feature preview tabs changes do not affect existing UI when flag is off

* Fix missing DefaultLayout in SQL editor templates + fix New tab

* Remove console log

* Remove DatabaseSelector for SQL editor on local

* Fix SQL editor shared favorites for local

* Fix test

* Ensure NewTab doesn't show up if flag is not toggled for SQL editor

* Decouple UI state changes from content-query and entity-types-infinite-query

* Fix tab closing unnecessary rerouting

* Beef up feature previews

* Fix create new table from table editor new tab

* Fix tabs getting incorrectly reset when going between table and SQL editors

* Fix last visited SQL snippet for both tabs and not tabs

* Fix last visited table for table editor tabs

* Clear dashboard history when closing last tab

* Fix loading dashboard history

* Add comment to refactor stores

* Ensure we only save up to 8 items for recent items for each type

* Remove unneccesary logic in tabs

* Smol style fix for DeleteAccountButton

* Smol fix

* Fix inability to close New tab

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-03-27 17:46:57 +08:00