mirror of
https://github.com/supabase/supabase.git
synced 2026-06-17 21:23:59 +08:00
## Context There's certain areas in the dashboard where we're calling `useTablesQuery` without a schema filter, in which case the dashboard then fires a query against the project's database to fetch _all_ tables across _all_ schemas - this could easily be a heavy query if there's a large number of relations in the project's database. Am hence opting to either add a schema filter if appropriate, or otherwise opt to use the infinite loading behaviour ## Changes involved - Add schema filter to `useTablesQuery` in database triggers and publications - Use infinite loading for tables in Cmd K for "Run query on table" and "Search database tables" ## To test - [x] Verify that database triggers + publications still function as expected - [x] Verify that CMD K "Run query on table" and "Search database tables" still function as expected (including search) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Implemented debounced infinite-scrolling table search in the command menu and SQL editor command flow. * Added a schema selector dropdown to publications management for easier navigation. * **Improvements** * Removed the “Schema” column from the publications tables UI. * Updated search guidance and table-picker status (counts/loading) during infinite browsing. * Trigger table listings now follow the selected schema context. * Refined command menu list height and improved the database-tables placeholder text. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
20 lines
923 B
TypeScript
20 lines
923 B
TypeScript
export const tableKeys = {
|
|
names: (projectRef: string | undefined) => ['projects', projectRef, 'table-names'] as const,
|
|
list: (
|
|
projectRef: string | undefined,
|
|
schema: string | undefined,
|
|
options?: { includeColumns?: boolean }
|
|
) => ['projects', projectRef, 'tables', schema, options].filter(Boolean),
|
|
infiniteListPrefix: (projectRef: string | undefined, schema?: string) =>
|
|
['projects', projectRef, 'tables', 'infinite', schema].filter(
|
|
(part) => part !== undefined && part !== null && part !== ''
|
|
),
|
|
infiniteList: (
|
|
projectRef: string | undefined,
|
|
schema: string | undefined,
|
|
options: { includeColumns?: boolean; pageSize?: number; nameFilter?: string }
|
|
) => [...tableKeys.infiniteListPrefix(projectRef, schema), options],
|
|
retrieve: (projectRef: string | undefined, name: string, schema: string) =>
|
|
['projects', projectRef, 'table', schema, name].filter(Boolean),
|
|
}
|