Files
supabase/apps/studio/components/interfaces/TableGridEditor
Alaister YoungandAlaister Young 3da6116b78 [FE-3442] fix(studio): include /rest/v1 in Data API access table URL (#46367)
The Data API Access section on the new-table panel was showing
`https://<ref>.supabase.co/<table>` instead of the correct
`https://<ref>.supabase.co/rest/v1/<table>`.

The bug was duplicated endpoint-resolution logic in
`ApiAccessToggle.tsx` that omitted `/rest/v1`. Replaced it with the
existing `getApiEndpoint` utility from `DataApi.utils.ts`, which already
handles this correctly (and is unit-tested).

Addresses
[FE-3442](https://linear.app/supabase/issue/FE-3442/data-api-access-shows-incorrect-table-url).

**Changed:**
- `ApiAccessToggle.tsx` now uses `getApiEndpoint` for URL construction,
ensuring `/rest/v1/` is always included.

## To test

1. Open the dashboard, go to Table Editor, click "New table".
2. Scroll to the "Data API Access" section, enter a table name (e.g.
`test_table`).
3. Confirm the URL shown is
`https://<ref>.supabase.co/rest/v1/test_table` (not
`https://<ref>.supabase.co/test_table`).
4. Try the same with a non-public schema — URL should be
`.../rest/v1/<schema>.<table>`.
5. With read replicas / load balancer selected via the database
selector, confirm the URL still resolves to
`<replica-or-lb-host>/rest/v1/<table>`.

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

## Summary by CodeRabbit

* **Refactor**
* Optimized Data API endpoint computation in the table editor interface
to improve performance and code maintainability.

<!-- 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/46367?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-26 17:30:30 +08:00
..