mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
## 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? Performance improvement / feature ## What is the current behavior? The Schema Designer fetches all tables in a single request via `useTablesQuery`. For schemas with 400+ tables this blocks first paint on a large payload. ## What is the new behavior? `SchemaGraph` uses `useInfiniteTablesQuery` (pageSize: 100) so the first 100 tables paint immediately. A "Load more tables" button appears above the legend whenever more pages remain, letting users load the rest on demand. ## Additional context <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a "Find table…" selector and keyboard shortcut to quickly locate and focus tables; supports incremental loading and debounced name search (with literal wildcard handling). * Schema Graph shows a bottom "Load more tables" control with loading state and preserves view after loading more. * **Refactor** * Table listing switched to infinite/paginated retrieval and improved "no tables" logic; server-side name filtering supported. * **Tests** * E2E tests add a schema-visualizer wait helper and update flows to support the paginated visualizer. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46402?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 -->
67 lines
2.8 KiB
TypeScript
67 lines
2.8 KiB
TypeScript
import { RegistryDefinations } from '../types'
|
|
|
|
export const SCHEMA_VISUALIZER_SHORTCUT_IDS = {
|
|
SCHEMA_VISUALIZER_COPY_SQL: 'schema-visualizer.copy-sql',
|
|
SCHEMA_VISUALIZER_COPY_MARKDOWN: 'schema-visualizer.copy-markdown',
|
|
SCHEMA_VISUALIZER_DOWNLOAD_PNG: 'schema-visualizer.download-png',
|
|
SCHEMA_VISUALIZER_DOWNLOAD_SVG: 'schema-visualizer.download-svg',
|
|
SCHEMA_VISUALIZER_AUTO_LAYOUT: 'schema-visualizer.auto-layout',
|
|
SCHEMA_VISUALIZER_FOCUS_SCHEMA: 'schema-visualizer.focus-schema',
|
|
SCHEMA_VISUALIZER_FIND_TABLE: 'schema-visualizer.find-table',
|
|
}
|
|
|
|
export type SchemaVisualizerShortcutId =
|
|
(typeof SCHEMA_VISUALIZER_SHORTCUT_IDS)[keyof typeof SCHEMA_VISUALIZER_SHORTCUT_IDS]
|
|
|
|
export const schemaVisualizerRegistry: RegistryDefinations<SchemaVisualizerShortcutId> = {
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_COPY_SQL]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_COPY_SQL,
|
|
label: 'Copy schema as SQL',
|
|
sequence: ['Mod+Shift+C'],
|
|
showInSettings: false,
|
|
options: { registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_COPY_MARKDOWN]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_COPY_MARKDOWN,
|
|
label: 'Copy schema as Markdown',
|
|
sequence: ['Mod+Shift+M'],
|
|
showInSettings: false,
|
|
options: { registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_DOWNLOAD_PNG]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_DOWNLOAD_PNG,
|
|
label: 'Download schema as PNG',
|
|
sequence: ['D', 'P'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true, registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_DOWNLOAD_SVG]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_DOWNLOAD_SVG,
|
|
label: 'Download schema as SVG',
|
|
sequence: ['D', 'S'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true, registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_AUTO_LAYOUT]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_AUTO_LAYOUT,
|
|
label: 'Open auto-layout dialog',
|
|
sequence: ['O', 'A'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true, registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_FOCUS_SCHEMA]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_FOCUS_SCHEMA,
|
|
label: 'Open schema selector',
|
|
sequence: ['O', 'S'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true, registerInCommandMenu: true },
|
|
},
|
|
[SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_FIND_TABLE]: {
|
|
id: SCHEMA_VISUALIZER_SHORTCUT_IDS.SCHEMA_VISUALIZER_FIND_TABLE,
|
|
label: 'Find table in schema',
|
|
sequence: ['O', 'T'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true, registerInCommandMenu: true },
|
|
},
|
|
}
|