Repository navigation
feat(studio): paginate Tables list with server-side search - #46514
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughMigrates 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. ChangesTable list infinite scroll with debounced search
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
Possibly related PRs
Suggested reviewers
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This comment has been minimized.
This comment has been minimized.
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › database.spec.ts › Database › Schema Visualizer › columns actions work as expected Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
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.
08ca66b to
37c7f22
Compare
Braintrust eval report
|
## 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 -->
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?
useInfiniteTablesQuerywith a 50-row page size, streaming pages as the user scrolls.IntersectionObserversentinel attached to the footer status row triggersfetchNextPage()whilehasNextPageis true; the same row doubles as the table count / loading indicator.nameFilterto the hook, which forwards it to pg-meta'sgetTablesPaginatedSql. 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
Bug Fixes
Tests