Commit Graph

43 Commits

Author SHA1 Message Date
Alaister Young
7e9badc6b8 chore(studio): migrate useStaticEffectEvent to React 19 useEffectEvent (#46415)
Studio is on `react@^19.2.6`, and `useEffectEvent` shipped stable in
React 19.2 with the same signature as the userland polyfill. This drops
the local hook in `apps/studio` and `apps/www` in favor of the built-in.

**Removed:**
- `apps/studio/hooks/useStaticEffectEvent.ts`
- `apps/www/hooks/useStaticEffectEvent.ts`
- `.claude/skills/use-static-effect-event/` — skill is obsolete

**Changed:**
- 26 call sites: dropped the `useStaticEffectEvent` import, added
`useEffectEvent` to the existing `react` import, renamed call sites
- `.claude/CLAUDE.md`: `apps/studio` row updated React 18 → React 19
- `.claude/skills/vercel-composition-patterns/SKILL.md`: removed stale
"Studio uses React 18, skip these patterns" warning

## To test

- `pnpm typecheck --filter=studio` — passes locally
- `pnpm typecheck --filter=www` — passes locally
- `grep -rn "useStaticEffectEvent"` returns nothing outside
`node_modules`
- Smoke-test areas that use the hook: schema visualizer edges
(intersection check), spreadsheet import, sign-in/CLI login flows, side
panels with unsaved-changes prompts

**Out of scope:** pre-existing Tailwind lint warning on
`DefaultEdge.tsx:141` (`outline` + `outline-1` conflict) — unrelated to
this migration

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

* **Refactor**
* Internal event handling migrated to React’s built-in event hooks
across the Studio app; no user-facing changes.

* **Documentation**
* Clarified React 19 compatibility and noted Studio now targets React
19.
  * Removed obsolete documentation for a deprecated internal hook.

<!-- 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/46415?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 -->

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-05-28 23:30:42 +08:00
Charis
3aec96f9c6 fix(studio): use measured node heights for instance diagram layout (#46075)
## Summary

The homepage instance diagram looks visually off when a project has read
replicas — see
[FE-3390](https://linear.app/supabase/issue/FE-3390/adjust-homepage-diagram-spacing-for-read-replicas).

Root cause: the dagre layout in `InstanceConfiguration.utils.ts` was
passing a fake `height: 25` (and a `-70` hack for the load balancer) for
every node, regardless of how tall the rendered node actually is. When
the Primary card grew taller after #45274 added the compute-metrics row,
the gap between the Primary node and the Read Replica node became
visually tight while the gap between the Load Balancer and Primary
stayed loose — the diagram looked lopsided.

## Fix

- Pass the **real measured height** of each node to dagre, sourced from
React Flow's internal measurement (`node.measured.height`).
- Run the layout in two passes:
1. First pass uses small per-type fallback heights so React Flow has
something to render and measure against.
2. Once `useNodesInitialized()` flips true, re-run dagre with the
measured heights and fitView.
- Keep the diagram at `opacity-0` until the measured pass completes, so
the fallback positions are never visible to the user. Subsequent data
refetches don't re-hide the diagram — once measured, it stays visible.
- Drop `NODE_ROW_HEIGHT` and the load-balancer `-70` hack. Replaced with
a small `NODE_HEIGHT_FALLBACKS` table used only on first paint.
- `ranksep` reduced from 160 → 60 since dagre now knows real heights.

Closes FE-3390.

## Test plan

- [x] Open the project homepage for a project with no read replicas —
diagram renders centered, single Primary node.
- [x] Open the project homepage for a project **with** a read replica —
Load Balancer → Primary → Replica spacing is visually balanced; no flash
of fallback positions on initial render; the diagram fades in once.

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

* **Improvements**
* More accurate infrastructure diagram layout with better node sizing
and spacing for initial and measured renders.
* Introduced fallback heights so diagrams render correctly on first
paint before measurements are available.
* Region containers now use a consistent fixed height for stable layout.
* Smoother, visually consistent diagram initialization with improved
opacity transition during layout setup.

<!-- 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/46075?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-19 16:13:26 -04:00
Ivan Vasilov
56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00
Charis
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
Alaister Young
7cf5df7b3e chore(studio): remove Fly.io integration code (#44336)
The Fly login/auth endpoints were removed from the management API
(supabase/platform#30987). This cleans up the associated studio code and
regenerates the API types.

Note: existing Fly projects are still running, so all `cloud_provider`
guards and Fly-specific UI (disk management, billing, pg_cron warnings,
etc.) are intentionally kept in place.

**Removed:**
- `sign-in-fly-tos.tsx` page
- `organization-by-fly-organization-id-mutation.ts`
- `project-by-fly-extension-id-mutation.ts`

**Other:**
- Regenerated API types to reflect removed endpoints
- Removed stale Fly-related comments in `InstanceConfiguration`,
`ObservabilityMenu`, `ReportsMenu`
- Fixed unrelated optional chaining bug in `SSOConfig.tsx`

## To test

- Check project creation flow still works
- Verify `/sign-in-fly-tos` no longer resolves

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-01 16:13:38 +08:00
Gildas Garcia
06190d15b9 Gildasgarcia/fe 2426 show relationship line context and highlight on hover (#44023)
## Problem

When you have many tables, it's hard to follow the relations between
them in the Schema Visualiser

## Solution

When selecting an edge (the line between tables), highlight it along
with the related tables and columns to make it easier.
Also, if there is enough space, display a popover showing the relation
details

## Screencasts


https://github.com/user-attachments/assets/11d35fa7-3674-4f13-b77f-8ebe25c66b04
2026-03-23 17:41:50 +01:00
Joshen Lim
a2b40468d0 Joshen/fe 2453 post rollout dashboard clean up (#43325)
## Context

Just cleaning up the `unifiedReplication` feature flag now that this is
fully rolled out

Also addresses some bugs that I came across while cleaning up,
specifically for the new home page
- Add enabled features flag check for read replicas in database
replication
- Infra diagram, read replicas
- View connection string CTA to open connect UI with the right database
selected
- Replaced all other actions with a "Manage replica" CTA which links to
the replica details page
2026-03-04 15:28:01 +08:00
Joshen Lim
3b7bba9a9a Add read replicas details page from database replication (#41784)
* Add read replicas details page from database replication

* Clean

* Address 🐰

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2026-01-19 13:44:41 +08: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
Ivan Vasilov
a40ccc4b45 chore: Clean onSuccess and onError props on useQuery (#40641)
* Remove all onSuccess and onErrors from useQuery.

* Minor fixes to all refetchInterval.

* Fix smaller type issues.
2025-11-20 14:08:56 +01:00
Joshen Lim
89e7abd7ca Add flag for read replicas (#39158)
* Add flag for read replicas

* nit
2025-10-02 02:08:41 +08: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
Saxon Fletcher
0f712bc9e2 Home New: Top (#38336)
* new home top

* misc clean ups

* branching truncate

* revert to button

* fixes

* Add comments + small style nudges

* Add comment

* nit

* Use Timestampinfo

* final final final v4

* I swear last nit i found

* FIX

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-04 10:58:30 +10:00
Joshen Lim
e75c4b2960 Swap useCheckPermissions with useAsyncCheckProjectPermissions part 3 (#37899)
* Swap useCheckPermissions with useAsyncCheckProjectPermissions part 3

* Fix loading state in edge function secrets
2025-08-13 19:07:35 +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
Jordi Enric
d61d32f007 fix new replica click (#35808)
* add portal true

* fix new replica click
2025-05-27 10:02:36 +02:00
Joshen Lim
0f0b02e0d9 chore: rework disk validation and cleanup (#34533) 2025-04-03 16:58:23 +08:00
Joshen Lim
a4243f438f Add restrictions for orioledb technical preview (#30410)
* Add restrictions for orioledb technical preview

* Add callouts to pgvector and postgis if orioledb

* Restrict restore to new project for orioledb

* Scaffold client side validation for preventing org upgrade if org has oriole db present

* Hook up proper logic for oriole

* Fix

* Remove console log

* Fix type

* Disable version selector if only one version is available

* chore: oriole badges

* UI updates based on requests

* Update copy

* Fix

* Dont open assistant if opt is selected

* Fix

* Fix

* Update badge

* Add feature flag for orioleDB

* Feature flag oriole check in plan update

---------

Co-authored-by: Paul Cioanca <paul.cioanca@supabase.io>
2024-11-30 17:36:15 +08:00
Joshen Lim
fa4ce4a949 Update disk size reduction validation (#30070)
* Update disk size reduction validation

* Fix

* Add docs

* Small fix
2024-10-25 09:36:27 +08:00
Joshen Lim
3a3360bbd0 Fix all usage of button tooltip (#30076)
* Fix all usage of button tooltip

* PRETTY
2024-10-24 13:32:47 +00:00
Joshen Lim
5dd67f9da5 Fix scroll issue in settings infra reactflow (#29644) 2024-10-03 10:48:27 +08:00
Ivan Vasilov
7d9343cc05 fix: Sticky resource banner (#29562)
* Make the resource banner sticky.

* Remove main from all layouts that are using it.

* Update apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>

* Fix the whitespace.

* Fix some of the pages with broken layouts.

* Fix a merge error.

* Fix the layout of the SQL editor.

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2024-09-30 17:42:32 +02:00
Jonathan Summers-Muir
4b6c2cbec0 feat: add compute badge (#23234) 2024-08-27 18:23:21 +02:00
Charis
5cd8384bca feat(docs), refactor(docs,studio): add regions list to docs (#28125)
* feat(docs), refactor(docs,studio): add regions list to docs

Adds list of supported AWS regions to docs.

Pulls the region information into `shared-data` package to provide common source of truth for dashboard and docs.

* style: format
2024-07-23 12:45:44 -04:00
Alaister Young
70da0f1d1d chore: cleanup packages (#27770)
* chore: cleanup packages

- Avoid circular imports
- Export API-types as types
- pg-format without depending on Node internal Buffer (not browser-compatible)
- Avoid importing from barrel files in ui dir

* chore: avoid barrel file imports in studio (#27771)

* chore: avoid barrel file imports

- Removes some unused imports
- Avoids barrel file import for faster builds + less memory

* add eslint rule

* type fixes

* delete layouts barrel

* delete components/grid barrel file

* delete components/grid/utils barrel file

* delete components/grid/components/common barrel file

* delete components/grid/components/editor barrel file

* delete components/grid/components/formatter barrel file

* delete components/grid/components/grid barrel file

* delete components/grid/components/header/filter barrel file

* remote components/grid/store barrel file

* remove components/interfaces/Auth/Policies barrel file

* delete components/interfaces/Settings/Logs barrel file

* delete components/ui/CodeEditor barrel file

* delete components/ui/Forms barrel file

* delete components/ui/Shimmers barrel file

* delete data/analytics barrel file

* delete hooks barrel file

* cleanup lib/common/fetch barrel file

* final * barral files cleanup

* global react-data-grid styles

* remove console.log

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>

* fix build

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
2024-07-04 14:48:10 +08:00
Joshen Lim
1127c4ba88 Project Level Permissions (#27347)
* fix: update Permission params

* fix: upgrade check permission hook to support project level role

* fix: usePermissionsLoaded

* fix: Permission params can be undefined

* Scaffold new access management UI

* Add validation

* Update roles view

* Add tooltip

* Add button to apply role to all projects

* Update UI to select projects first instead of roles

* Merge master update UI

* Midway trying to implementation project level perms API

* First pass implementating updating project level permissions

* Add client side validation for assigning/removing roles

* Midway implementing new invites

* Integrate most of the project level permissions functionality

* fix: filter out org-level permissions before checking

* Add relevant UI guards in org level pages for project role POV

* Minor refactors

* Small refactors

* More fixes

* Moar refactors

* More fixes

* More fixes

* Refactor update role logic and smack some test cases on it

* Fixes

* Fix type issue

* Fix type

* more fixes, refactors, adding checks...

* MORE fixes

* Add perms checking for replicas

* Add ButtonTooltip component and use them to prevent repetition of pointer events auto for buttons with tooltips

* Convert all buttons with tooltips to use ButtonTooltip

* refactor

* PRettier

* Small fix

* Remove commented out code in organization-invitation-accept-mutation

* fix: switch to use the platform oauth authorizations routes

* Add perms checking for org audit logs and org oauth apps

* PRettier

* Fix incorrect URL for oauth app flow

* Fix incorrect URL for oauth app flow

* Fix

* Add perms checking for warehouse related UI

* Update roles helper icon

* remove unused lib

* Update package lock... again

* Update package lock... again

* Smalllll update

* Update some checks

* Add gate for project level permissions

* Last fix

* update codegen

* Update warehouse endpoint routes

* Fix

---------

Co-authored-by: phamhieu <phamhieu1998@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
2024-07-01 17:59:54 +08:00
Terry Sutton
91c8e6538d Chore/hide infrainfo on fly (#27035)
* Hide InfraInfo component on fly projects

* Show loading screen on the read replicas widget until the project details come in.

* Revert "Show loading screen on the read replicas widget until the project details come in."

This reverts commit 79611f4b57.

* Fix the flash on read replicas on Fly deploys.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-06-05 19:14:36 +00:00
Joshen Lim
21890675e5 Chore/sentry fixes 050624 (#27025)
* Add check before generating nodes in settings infrastructure

* Fix conditional in ResourceContent and add some typing

* Wrap checkIfPrivate with try catch

* Add ? in TableEditor.utils generateTableFieldsFromPostgresTable

* More typing

* Add ternary in RPC

* Remove mobx from API docs v1

* Fix renaming folder in storage explorer
2024-06-05 16:32:24 +07:00
Joshen Lim
cd4b7c0497 Remove all usage of read replicas enabled flag (#26819)
* Remove all usage of read replicas enabled flag

* Add fix for fly

* Fixes

* Prettier

* Swap to DropdownMenuRadioGroup
2024-05-29 11:46:15 +08:00
Joshen Lim
b4f5c0c16a Chore/support more granular updates via events for spinning up replica (#26378)
* Support more granular updates via events for spinning up replica

* Add duration estimates as tooltips

* Show granular error message if error happens during replica set up

* Add support for hours in duration estimates
2024-05-17 14:09:58 +08:00
Joshen Lim
b638f53ce0 Chore/remove optimistic rendering for spinning up replicas (#26331)
* Remove optimistic rendering when spinning up read replicas

* Fix missing edge when load balancer renders

* Tiny style fix
2024-05-16 13:04:18 +08:00
Joshen Lim
271734eec2 Chore/support checking replication lag in database reports (#26290)
* Init replication lag chart in database reports

* Navigate to replication lag chart via query params

* Add view replication lag CTA in map view

* Add replication lag metric to instance node view

* Prettier
2024-05-14 20:00:20 +08:00
Joshen Lim
99635fbb5e Support restarting replicas (#26240)
* Support restarting replicas

* Support restarting replica through map view

* Lint

* Lint
2024-05-14 15:47:27 +08:00
Joshen Lim
ac8cdcc58c Read replicas fix not removing node from UI when replica is dropped (#23267)
* read replicas fix not removing node from UI when replica is dropped

* Update refresh durationm
2024-04-29 16:54:33 +08:00
Jonathan Summers-Muir
645273cb45 Chore/update confirmation modal (#22328)
* Update confirmation modal

* update all props

* Update ExtensionCard.tsx

* clen up
2024-04-02 13:39:27 +08:00
Joshen Lim
cea8e45166 Chore/read replicas fixes 040324 (#21731)
* Remove size selection and add info on rr billing

* Add prompt in SQL editor if trying to run mutation query in read replica

* Fix

* Fix dropping replica not optimistically updating, and support new replica statuses

* Invalidate load balancers after read replicas are spun up

* fix
2024-03-06 15:31:09 +08:00
Joshen Lim
3e30172946 Chore/read replica fixes 260224 (#21547)
* Staging: only allow apse1 as selection for replica

* Fix modal stuck in loading state if dropping replica fails for some reason

* Add warnings for RR based on cloud provider and pg version, and fix support page not automatically selecting project ref from query param into form

* Add warnings on add ons side panels for compute and pitr RE replicas

* Add notice text RE changing compute size if read replicas are preent

* Add options to change compute size and delete all replicas from settings/infrastructure

* Lint
2024-02-27 11:52:12 +08:00
Joshen Lim
d1ab275bea Chore/read replica final touches (#21420)
* Add validation for max replicas check

* Small UI fixes

* Add useMemo for edges

* Fix nodes not shwoing up when switching between map and flow view

* Fix logs explorer copy button

* Add edge changes to useEffect

* Bump wait duration when creating replica

* Sync database selector and use pooler checkbox states across panels on settings database

* Fix InstanceConfiguration not showing any nodes

* Sort databases in DatabaseSelector to have primary first

* Logs explorer border fotter

* Add database selector for edge logs

* Make buttons more concise in logs

* Clean up

* Fix

* Fix home page empty empty state

* Attempt to support pooler logs

* minor qol fix for database selector

* Update shared-data pgbouncer to supavisor

* small fix
2024-02-23 18:08:06 +08:00
Joshen Lim
fc405ce035 Chore/expose load balancer api endpoint in api settings (#21314)
* Expose load balancer API endpoint in API settings

* Add load balancer as a node in infrastructure config

* Add load balancer node to infra config

* Fix
2024-02-21 16:58:15 +08:00
Joshen Lim
aadaa25945 Disable scroll zoom for RR UI (#20730) 2024-01-25 17:54:03 +07:00
Kevin Grüneberg
d12332ea5a chore: xmas cleanup (#19938) 2024-01-04 17:27:49 +01:00
Joshen Lim
539c2bbace feat/rr-functionality (#19466)
* Implement read, create, delete replicas

* Long poll replica statuses if any one of them is coming up

* Support querying replicas in SQL editor

* Add optimistic rendering for setting up and removing replicas

* Small style fix for database selector in SQL editor

* Small fix

* Add Alerts around PITR and PG upgrades RE read replicas

* Small fixes after testing flag off

* Add UI guards to check that project has PITR before deploying replica

* Fix

* Address feedback

* Fix

* Update replicas RQ to enable based on flag
2023-12-08 13:41:35 +08:00
Joshen Lim
3620ca8ebe RR Scaffolding Work (#18658)
* Init demo world map for read replicas

* Update package.json

* Scaffold and mock data for flow view of project settings infrastructure configuration

* Shift map stuff and install deck.gl to experiment

* Flesh out map view a bit more

* Scaffold deploy new replica panel

* Add restart replica option

* Add animations, shift node generation into utils, attempt to show region nodes

* Experiments

* General improvement to chart and map UI

* Improve some copy writing for restart and drop replica modals

* Simplify loading, error, success states in DatabaseSettings

* Scaffold DB selection in connection string section

* Link replica node to connection string

* Scaffold database selection for SQL editor

* Make DatabaseSelector into a component

* Add database selector to infra activity

* Update

* Hide read replicas UI behind a feature flag

* Update flags

* Update package-lock

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2023-11-27 12:50:19 +08:00