Commit Graph

273 Commits

Author SHA1 Message Date
Joshen Lim
8f3b47236c Fix ColumnType not scrollable via mousewheel (#42277)
## Context

Was informed of this UI bug through this PR
[here](https://github.com/supabase/supabase/pull/42126) - apart from
shifting the ScrollArea component, there's also known issue with
ScrollArea and Popover which we need to set `modal` to `true` for the
`Popover`

## To test

- [ ] Verify that you can scroll via mouse wheel on the ColumnType
component (Table Editor -> new table -> column type)
<img width="698" height="471" alt="image"
src="https://github.com/user-attachments/assets/b24af3f9-80f6-4dfc-9fa2-1492fe597598"
/>


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

## Summary by CodeRabbit

* **Improvements**
* Popover in column editor now supports modal rendering mode with
enhanced scrolling behavior.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-29 17:19:57 +08:00
Ali Waseem
ea1b95d29b feature: batch and save operations for cell content updates (#42120)
* added initial queue operations and feature flag

* updated types

* added dirty state tracking on columns

* updated queue operations

* updated operation types and queue

* updated spacing

* removed on cancel

* updated to support saving

* updated to include eye details

* updated spacing for orders

* updated to support shortcuts

* added feature preview

* updated to unify queue methods

* added key generation

* used unique keys rather than random uuid

* updated based on code review

* operation key

* updated handle cancel

* updated remove operation button

* updated views for toast

* updated logic to support optimistic updates

* updated types

* code cleanup: remove LLM slop

* updated PR bug

* updated preview for logout

* updated based on code review

* removed use effect as it was causing problems

* fixed toast mounting away from sql editor

* removed toast for dedicated action bar

* cleaned up logic

* updated queue operations

* renamed method

* updated name for types

* updated comment

* fixed code rabbit solution

* added check for changed column

* added tests
2026-01-28 06:54:30 -07:00
Charis
d27bb74258 test(studio): add tests for data api toggles (#42051)
* test(studio): add tests for data api toggles
2026-01-22 12:46:54 -05:00
Joshen Lim
c6b2fe6fee Popover ui component to use portal by default, remove all manual declaration of portal for PopoverContent in dashboard (#41818)
* Popover ui component to use portal by default, remove all manual declaration of portal for PopoverContent in dashboard

* Forgot to add ui changes lol

* Clean uop
2026-01-20 11:58:31 +08:00
Joshen Lim
17715744b2 Update programmatically generated policies to use authenticated role (#41812)
* Update programmatically generated policies to use authenticated role

* Fix test

* Fix unit tests
2026-01-15 10:27:07 +07:00
Sean Oliver
30adf96a0e Simplify realtime experiment to rely on PostHog targeting (#41210) 2026-01-12 20:58:00 -08:00
Saxon Fletcher
0dab4d93fe Enable or disable Data API access per table (#41218)
* feat(studio): add mutation to update table access privileges

Adds a mutation to update table grants for `anon` and `authenticated`
roles.

* feat(studio): add data api toggles

Add toggles to the Table Editor, allowing fine-grained grants to the
anon and authenticated roles.

* fix(studio): don't show rls policies warning if table not exposed

RLS policies warning was showing in Table Editor side panel even if
table was not exposed due to no grants to anon/authenticated.

* fixup! feat(studio): add data api toggles

* fixup! feat(studio): add data api toggles

* fix(studio): revalidate rls lints when table grants are toggled

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2026-01-07 12:12:15 -05:00
Saxon Fletcher
1bcecb1c42 Table list entity api badge copy (#41547)
* api badge copy

* ts

* test

* API badge policy row (#41548)

api badge policy row

* refine

* fix tiny nits

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2026-01-06 08:04:40 +10:00
Joshen Lim
a88c88fa36 Hide RLS disabled CTA in table editor header if no lints (#41517)
* Hide RLS disabled CTA in table editor header if no lints

* Clean

* Update e2e tests

* INvlidate lints when creating tbale

* Revert

* Invalidate lints when duplicating table
2026-01-05 12:14:19 +07:00
Sean Oliver
1077b50a5b fix(studio): convert tableCreateGeneratePolicies flag to multivariate for PostHog experimentation (#41706)
Co-authored-by: pamelachia <26612111+pamelachia@users.noreply.github.com>
2026-01-04 20:12:57 -08:00
Ali Waseem
7e3c714464 chore: updated font size on RLS modal (#41544)
updated font size
2025-12-22 20:29:35 +00:00
Charis
1d49e9e954 feat(studio): show icon on tables exposed by data api (#41416)
* feat(studio): show icon on tables exposed by data api

Show an icon in the Table Editor for tables that are exposed via the
Data API.

* refactor(studio): move table api access query up to parent

* fix(studio): invalidate table privileges query on table create

* fix(studio): make RLS disabled warning on table editor more obvious

Change from warning -> danger

* Only show add foreign key in side panel if isSuccess

* chore(studio): put data api exposed badge behind feature flag

Only show badge for now if flag `dataApiExposedBadge` is enabled.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-18 16:50:26 +00:00
Ivan Vasilov
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
Joshen Lim
4c62839e28 Prevent ForeignRowSelector from firing multiple saves when clicked (#41381)
* Prevent ForeignRowSelector from firing multiple saves when clicked

* Smol
2025-12-17 23:15:53 +08:00
Ivan Vasilov
cc47bcfa6d chore: Migrate studio to use ui-patterns/shimmeringLoader (#41405)
* Add shimmering-loader CSS to ui-patterns.

* Import the shimmering-loader classes from the ui-patterns component.

* Remove ShimmeringLoader from studio.

* Migrate studio to use ui-patterns/ShimmeringLoader.

* Migrate away from using default import for ShimmeringLoader.

* Fix the css imports in docs and studio.
2025-12-17 14:54:07 +01:00
Marouane Souda
0905f22d3d fix(studio): show correct column error on composite foreign keys (#41320)
* fix(studio): show correct column error on composite foreign keys

* remove duplicate line
2025-12-16 10:24:39 -07:00
Danny White
3fdacb2cca chore(studio): delete Confirm Modal component (#41295)
* docs

* naming

* docs

* mini fix

* update policies component

* use destructured prop

* rls policies dialogs

* custom domain dialogs

* restart server dialog

* remove ConfirmDialog (aka ConfirmModal)

* remove unrelated changes

* delete unrelated file

* language

* Update apps/studio/components/interfaces/Storage/StoragePolicies/StoragePolicies.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fixed broken test

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-12-12 17:23:24 +08:00
Saxon Fletcher
9f3af6e502 Generate policies experiment (#40881)
* policy generation

* add ai

* refactor

* table create performance

* policy list

* style

* simplify

* refactor

* flag

* tracking

* track

* ts

* fixes

* connection string

* re-add rls and realtime toggle

* restore old logic

* base path

* badge

* false rls

* copy

* add permissions button

* Refactor based on comments

* Fix TS

* More nudge

* Update tests

* Fix test

* Fixx

* Fix

* Address feedback

* Address issues

* Improve experiment telemetry for generate policies A/B test (#41172)

* Address code rabbit catch

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Sean Oliver <882952+seanoliver@users.noreply.github.com>
2025-12-12 12:44:11 +08:00
Ali Waseem
e7a4ca9b74 Feature: show index advisor in table editor (#41166)
* added table advisor query

* updated to include table editor performance

* updated JSON B

* added side panel

* updated query indexes to show highlights context

* show index advisor in table editor

* updated invalidation logic

* added color updates

* added query indexes

* updated query performance type

* updated overflow and title

* put behind flag

* remove gap

* added on close

* Update apps/studio/data/database/table-index-advisor-query.ts

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

* updated styling

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-12-10 09:28:45 -07:00
Ivan Vasilov
f01deddb49 fix: Fix minor issue in the foreign key selector (#41235)
Change the isPending state to isLoading.
2025-12-10 15:27:58 +00:00
Ivan Vasilov
0d5be306ef chore: Bump React Query to v5 (#40174)
* Bump the deps, refactor deprecated code.

* Migrate keepPreviousData usage.

* Migrate all uses of InfiniteQuery.

* Fix refetchInterval in queries.

* Migrate all use of isLoading to isPending in mutations.

* Fix accessing location in claim-project.

* Fix a bug in duplicate query keys.

* Migrate all queries to use isPending.

* Revert "Fix accessing location in claim-project."

This reverts commit 2a07df64b5.

* Revert the rss.xml file to master.
2025-12-10 10:10:29 +01:00
Charis
8e705ecdbc fix(export all rows): use cursor pagination if possible (#40536)
Exporting all rows (in CSV, SQL, or JSON format) currently uses offset pagination, which can cause performance problems if the table is large. There is also a correctness problem if the table is being actively updated as the export happens, because the relative row offsets could shift between queries.

Now that composite filters are available in postgres-meta, we can change to using cursor pagination on the primary key (or any non-null unique keys) wherever possible. Where this is not possible, the user will be shown a confirmation dialog explaining the possible performance impact.

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-08 13:39:10 -05:00
Ali Waseem
86b1e03658 fix: sentry type errors (#41073)
* fix SUPABASE-APP-AV8

* fix SUPABASE-APP-AV0

* fix: SUPABASE-APP-ATK
2025-12-04 10:36:44 -07:00
Danny White
031b227165 studio(chore): badge component defrag (#40118)
* component clean up

* optically center

* docs and type size

* code badge variant

* sensible defaults

* fix product menu flex

* badge sweep

* new project badges

* logs

* compute badge

* studio badge sweep

* www sweep

* docs sweep

* clean up

* fixes

* cleanup

* fixes

* better docs

* fixes

* misc fixes

* consistency

* Minor fixes for issues i found

* simplify mt-0

* mt simplification

* remaining optical alignment

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-02 11:15:50 +11:00
Vaibhav
dbb5c1bdf5 fix: composite primary key sql generation in table editor (#40942)
fixes malformed sql syntax where column quotes were incorrectly placed around comma separator

closes #40931
2025-12-01 07:53:49 -07:00
Saxon Fletcher
9d66964b62 table create performance (#40857)
* table create performance

* test

* Clean up + refactor

* Nit housekeeping

* Minor housekeeping again

* Fix

* Fixy

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-27 20:27:19 +08:00
Danny White
46ac132051 chore(studio): empty state improvements (#40807)
* migrations

* clearer value prop

* consistent verb

* migration input

* triggers

* extract trigger buttons

* database backups

* schema title

* unrelated nit

* fix

* shared component

* ui-patterns

* rename

* improve docs

* remove redundant overrides

* remove old file

* prettier fix

* fix type error

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-27 17:26:20 +08:00
Danny White
d653617cdd chore(studio): improve inline code styling (#40724)
* sweep language

* update class docs

* additional

* basic docs

* sweep relevant instances

* replace text-code

* additional in sweep

* Tiny fix

* prettier

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-24 16:34:30 +08:00
Tyler Clark
6781e0010f feat(ForeignRowSelector): persist and retrieve sort preferences in select record modal (#39261)
* feat(ForeignRowSelector): persist and retrieve sort preferences in sessionStorage

* feat(ForeignRowSelector): use existing table sort local storage

* fix(ForeignRowSelector): prevent re-hydration of persisted sorts on subsequent renders

* small refactors

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-11-21 08:44:40 +00:00
Ivan Vasilov
43cc61818c chore: Migrate all isPending uses in react-query (#40642)
* Bump react-query. Minor type and logic fixes.

* Migrate all use of isLoading to isPending in mutations.

* Fix type errors.
2025-11-20 16:44:53 +01:00
Charis
044a575552 test: parallelize table editor tests (#40404)
Table editor tests were being run serially because they would otherwise
stomp all over each other in setup. But this made them really slow. This
PR changes them to run in parallel, and makes sure the setup step runs
only once by using a file lock.

Also cleans up miscellaneous other sources of flakiness in tests.

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2025-11-19 07:14:13 -07:00
Ali Waseem
dd05ebf88e updated side panel editor to update column with new name change (#40530)
* updated side panel editor to update column with new name change

* Invalidate lints when updating a table.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-11-17 10:10:33 -07:00
Charis
9a139e612e fix(table editor): unnecessary column updates (#40446)
* fix(table editor): unnecessary column updates

When you use the table editor to edit a table containing array columns,
even if you _make no changes_, an update is sent to alter the array
column's type to its original type. This happens because we aren't
correctly checking for array column equality when we diff old/new column
configs. Fixed this so no update will be sent if the column isn't
changed.

* Nit refactor

* fix(table editor): bug with editing column twice in a row

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-17 08:08:26 -07:00
Sean Oliver
cc33c26743 Add realtime button A/B test with three variants (GROWTH-524) (#39748) 2025-11-17 00:53:06 +08:00
Joshen Lim
1f6ce0d096 Table Editor link to policies page use table name as search instead of ID (#40376)
* Table Editor link to policies page use table name as search instead of ID

* Nit
2025-11-12 18:46:58 +08:00
Charis
8828c4e734 refactor(close confirmation modal): abstract out useConfirmOnClose hook (#40310)
Abstract out a hook, useConfirmOnClose, for the pattern where we show a
confirmation modal on close, conditional on whether the user has made
edits.

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-11-11 13:34:50 -05:00
Charis
50a0408e60 fix(table editor): prevent unnecessary update requests (#40192)
Continues on from a0afa9e, reducing the number of unnecessary requests made when table changes are saved.

Currently, when you open the "Edit table" side panel, make zero changes, and click "Save", an unnecessary request runs to:

- Alter the table's comment to its existing comment
- Alter the table's schema to its existing schema
- Alter the table's RLS enable status to its existing RLS enable status

This PR changes the payload so we only alter what has actually changed. It also adds some refactoring to define clearer types and add type safety for the three possible kinds of table save actions (create new, duplicate, update existing).

After this, there are still a few unnecessary column update actions happening on array columns; those will be fixed in a final PR.
2025-11-11 14:54:43 +00:00
Ali Waseem
ac6db41662 Fix: Make the FK editor faster when loading tables (#40259)
* updated selector code to be more efficient

* updated styling to show a cleaner table loader

* updated format assignment

* disable selector when loading

* updated request to fetch tables

* updated key rendering
2025-11-10 14:59:43 -05:00
Charis
df63ce3658 fix(mssql foreign tables): disallow sort on columns filtered for equality (#40137)
There is an edge case interaction between the Postgres query parser and
MSSQL foreign tables, where the query parser may drop sort clauses that
are redundant with applied filters. This leads to invalid MSSQL syntax,
because the resulting query has a `limit` but no `sort`, and the user
sees a confusing error message.

This PR detects this edge case on MSSQL foreign tables. There are three
cases:
1. The user filters by a column, but there are still other columns
available for sorting. The default search for a sorting column will
leave out the filtered column.
2. The user filters by a column/several columns, and there are no more
columns that can be used for sorting. We stop the query and show an
admonition.
3. The user filters by a column, then tries to sort by the same column.
We stop the query and show an admonition.
2025-11-06 13:14:30 -05:00
Charis
a0afa9eef2 fix(table editor): request fired per column when updating table (#40160)
When updating a table with many columns, a request is fired per column,
causing potential rate-limiting.

The biggest contributor is a bug in the `comment` config of each column.
If columns have no comment, we coerce the comment to an empty string,
but our column payload diff function sees this as a difference, thus
tries to set a new comment on every column. Unfortunately this is not a
one-time issue, because Postgres considers an empty comment to be null,
and corces it back to null, and on and on we go in a giant circle.

The fix is just to not coerce to empty strings on our end.

There are a few other requests that we might be able to shave, but this
is by far the noisiest one.
2025-11-05 11:57:49 +00:00
Joshen Lim
75e1717a02 Remove barrel files part 02 (#39956)
* Remove barrel files part 02

* Clean up
2025-10-30 23:50:14 +08:00
Joshen Lim
72d50d8ac4 Remove barrel files part 1 (#39955) 2025-10-29 18:07:20 +08: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
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 Dimitrovski
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 Young
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