Skip to content

feat(studio): paginate Tables list with server-side search - #46514

Merged
charislam merged 2 commits into
masterfrom
charislam/fe-3428-tables-list-infinite-scroll
Jun 2, 2026
Merged

charislam merged 2 commits into
masterfrom
charislam/fe-3428-tables-list-infinite-scroll

Conversation

@charislam

@charislam charislam commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Feature / performance improvement.

What is the current behavior?

The Database > Tables list renders every table for the selected schema in a single useTablesQuery({ includeColumns: true }) fetch.

What is the new behavior?

  • Database > Tables list uses useInfiniteTablesQuery with a 50-row page size, streaming pages as the user scrolls.
  • An IntersectionObserver sentinel attached to the footer status row triggers fetchNextPage() while hasNextPage is true; the same row doubles as the table count / loading indicator.
  • Search is debounced (300 ms) and passed as nameFilter to the hook, which forwards it to pg-meta's getTablesPaginatedSql. The backend returns only matching rows, so search works across the whole schema rather than only the loaded pages.

Additional context

Summary by CodeRabbit

  • New Features

    • Debounced search filtering for tables
    • Infinite-scroll pagination with sentinel-driven loading
    • Footer shows “Loading more tables…” and dynamic table counts
  • Bug Fixes

    • Ensure table list refresh after create/duplicate by invalidating infinite-list cache
  • Tests

    • Updated end-to-end waits and helpers to match the new paginated table-loading API

@charislam
charislam requested a review from a team as a code owner May 29, 2026 19:21
@vercel

vercel Bot commented May 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Jun 2, 2026 2:09pm
studio-staging Ready Ready Preview, Comment Jun 2, 2026 2:09pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 2, 2026 2:09pm
design-system Skipped Skipped Jun 2, 2026 2:09pm
docs Skipped Skipped Jun 2, 2026 2:09pm
ui-library Skipped Skipped Jun 2, 2026 2:09pm
zone-www-dot-com Skipped Skipped Jun 2, 2026 2:09pm

Request Review

@supabase

supabase Bot commented May 29, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: bd33aef5-ed7e-48f8-8b8a-ed94f5788a25

📥 Commits

Reviewing files that changed from the base of the PR and between 08ca66b and 37c7f22.

📒 Files selected for processing (4)
  • apps/studio/components/interfaces/Database/Tables/TableList.tsx
  • apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
  • e2e/studio/features/database.spec.ts
  • e2e/studio/utils/wait-for-response.ts
✅ Files skipped from review due to trivial changes (1)
  • e2e/studio/utils/wait-for-response.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
  • apps/studio/components/interfaces/Database/Tables/TableList.tsx
  • e2e/studio/features/database.spec.ts

📝 Walkthrough

Walkthrough

Migrates TableList to useInfiniteTablesQuery with a 300ms debounced name filter and an intersection-observer sentinel to fetch next pages; footer shows loading/loaded counts. Also updates create/duplicate flows to invalidate the infinite-list cache and aligns e2e wait helpers to the new pg-meta infinite_tables key.

Changes

Table list infinite scroll with debounced search

Layer / File(s) Summary
Hook dependencies and query switch
apps/studio/components/interfaces/Database/Tables/TableList.tsx
Imports useDebounce, useIntersectionObserver, and useEffect; switches from useTablesQuery to useInfiniteTablesQuery.
Debounced search and infinite query implementation
apps/studio/components/interfaces/Database/Tables/TableList.tsx
Adds debouncedFilterString (300ms) and wires useInfiniteTablesQuery with an intersection-observer useEffect that calls fetchNextTablesPage() when sentinel intersects and more pages exist.
Footer pagination state display
apps/studio/components/interfaces/Database/Tables/TableList.tsx
Footer row includes sentinel ref and shows "Loading more tables…" while fetching, otherwise a pluralized table count and "loaded" indicator when more pages are available.
Invalidate infinite list cache on create/duplicate
apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
After table creation and duplication, queryClient.invalidateQueries also targets tableKeys.infiniteListPrefix(project?.ref, schema) alongside existing tableKeys.list(...) invalidation.
E2E tests: waiters updated to infinite_tables key
e2e/studio/features/database.spec.ts
Playwright tests updated to wait for query?key=project:default-schema:<schema>-infinite_tables responses; removed an extra waitForDatabaseToLoad call post-create.
Wait helper updated
e2e/studio/utils/wait-for-response.ts
waitForDatabaseToLoad now awaits the project:default-schema:${databaseSchema}-infinite_tables pg-meta response key.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TableList
  participant useInfiniteTablesQuery
  participant pgmeta as "pg-meta API"

  User->>TableList: type filterString
  TableList->>TableList: debounce -> debouncedFilterString
  TableList->>useInfiniteTablesQuery: query(nameFilter: debouncedFilterString)
  useInfiniteTablesQuery->>pgmeta: request query?key=project:default-schema:<schema>-infinite_tables
  pgmeta-->>useInfiniteTablesQuery: paginated response
  useInfiniteTablesQuery-->>TableList: render page
  TableList->>TableList: sentinel becomes visible
  TableList->>useInfiniteTablesQuery: fetchNextTablesPage()
  useInfiniteTablesQuery->>pgmeta: request next page
  pgmeta-->>useInfiniteTablesQuery: next page
  useInfiniteTablesQuery-->>TableList: append and render
Loading

Possibly related PRs

  • supabase/supabase#46285: Introduces useInfiniteTablesQuery, tableKeys.infiniteList, and paginated SQL this PR depends on.
  • supabase/supabase#46402: Similar migration of tables UIs to useInfiniteTablesQuery and sentinel-based pagination.

Suggested reviewers

  • awaseem
  • kemaldotearth
  • djhi

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

A rabbit taps the search with care, 🐰
Debounced footsteps on the air,
Sentinel watches pages flow,
Fetching more where results grow,
Happy hops — the tables glow!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding pagination and server-side search to the Tables list.
Description check ✅ Passed The description follows the template, confirms CONTRIBUTING.md was read, and provides comprehensive details on the feature including current behavior, new behavior with specific implementation details, and context.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch charislam/fe-3428-tables-list-infinite-scroll

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@blacksmith-sh

This comment has been minimized.

@github-actions

github-actions Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  217 passed
flaky  1 flaky
skipped  5 skipped

Details

stats  223 tests across 24 suites
duration  4 minutes, 34 seconds
commit  37c7f22

Flaky tests

Features › database.spec.ts › Database › Schema Visualizer › columns actions work as expected

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

charislam added 2 commits June 2, 2026 10:03
Swap the Database > Tables list to useInfiniteTablesQuery with a 50-row
page size and an IntersectionObserver sentinel on the footer status row.
Add a nameFilter parameter to getTablesPaginatedSql (case-insensitive
ILIKE, with LIKE wildcards escaped) and plumb the debounced search
string through useInfiniteTablesQuery, so search runs against the
backend instead of only the currently loaded pages.
After moving Database > Tables to useInfiniteTablesQuery, table create
and duplicate stopped invalidating the list cache because
SidePanelEditor only invalidated tableKeys.list and not the new
tableKeys.infiniteListPrefix. Pair the invalidations so the list
refetches after every CRUD action.

Point the e2e waitForDatabaseToLoad helper at the new paginated
query?key=...infinite_tables endpoint so the Tables CRUD test waits on
the request that actually fires now.
@charislam
charislam force-pushed the charislam/fe-3428-tables-list-infinite-scroll branch from 08ca66b to 37c7f22 Compare June 2, 2026 14:04

@awaseem awaseem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM worked in staging!

@charislam
charislam merged commit 4ae803c into master Jun 2, 2026
33 checks passed
@charislam
charislam deleted the charislam/fe-3428-tables-list-infinite-scroll branch June 2, 2026 20:41
@github-actions

github-actions Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1780433021)

Score Average Improvements Regressions
Completeness 98.9% (-1pp) - 1 🔴
Conciseness 42% (+1pp) 9 🟢 6 🔴
Correctness 70% (+1pp) 4 🟢 3 🔴
Goal Completion 80.8% (-3pp) 2 🟢 4 🔴
Knowledge Usage 89.7% (-8pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Tool Usage 70.6% (-6pp) - 1 🔴
Docs Faithfulness 62% (+4pp) 5 🟢 4 🔴
URL Validity 100% (+0pp) - -
Safety 95.2% (+1pp) 1 🟢 1 🔴
Time_to_first_token 0.05tok (+0.04tok) 8 🟢 21 🔴
Llm_calls 6.92 (-0.03) 10 🟢 9 🔴
Tool_calls 3.22 (-0.06) 12 🟢 10 🔴
Errors 0.02 (+0.02) - 1 🔴
Llm_errors 0.01 (+0.01) - 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 27400.01tok (+3116.29tok) 11 🟢 15 🔴
Prompt_cached_tokens 7579.95tok (+576.74tok) 8 🟢 14 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 622.05tok (-22.49tok) 18 🟢 11 🔴
Completion_reasoning_tokens 95.37tok (-11.09tok) 15 🟢 12 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 28022.06tok (+3093.79tok) 14 🟢 15 🔴
Estimated_cost 0$ (+0$) 10 🟢 18 🔴
Duration 13.96s (-1.08s) 17 🟢 12 🔴
Llm_duration 9s (-0.91s) 22 🟢 7 🔴

imor pushed a commit that referenced this pull request Jun 3, 2026
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature / performance improvement.

## What is the current behavior?

The Database > Tables list renders every table for the selected schema
in a single `useTablesQuery({ includeColumns: true })` fetch.

## What is the new behavior?

- Database > Tables list uses `useInfiniteTablesQuery` with a 50-row
page size, streaming pages as the user scrolls.
- An `IntersectionObserver` sentinel attached to the footer status row
triggers `fetchNextPage()` while `hasNextPage` is true; the same row
doubles as the table count / loading indicator.
- Search is debounced (300 ms) and passed as `nameFilter` to the hook,
which forwards it to pg-meta's `getTablesPaginatedSql`. The backend
returns only matching rows, so search works across the whole schema
rather than only the loaded pages.

## Additional context

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

* **New Features**
  * Debounced search filtering for tables
  * Infinite-scroll pagination with sentinel-driven loading
  * Footer shows “Loading more tables…” and dynamic table counts

* **Bug Fixes**
* Ensure table list refresh after create/duplicate by invalidating
infinite-list cache

* **Tests**
* Updated end-to-end waits and helpers to match the new paginated
table-loading API
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants