add a toggle to filter empty schemas and db#9712
Draft
Light2Dark wants to merge 1 commit into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/datasources/datasources.tsx">
<violation number="1" location="frontend/src/components/datasources/datasources.tsx:156">
P1: The new empty-schema filter treats `tables.length === 0` as definitively empty, but `0` is also the lazy-loading state. This can hide schemas/databases before table fetches run, preventing users from ever loading their tables.</violation>
</file>
Architecture diagram
sequenceDiagram
participant UI as DataSources Panel
participant Store as Jotai Store (localStorage)
participant Backend as Backend API
participant Cache as React useMemo
Note over UI,Cache: Initial Load
UI->>Store: NEW: read hideEmptyDatasourcesAtom (from localStorage key "marimo:datasources:hideEmpty")
Store-->>UI: false (default)
UI->>Backend: fetch databases & schemas
Backend-->>UI: rawConnections with all databases & schemas
Note over UI,Cache: Toggle Filter
UI->>UI: user clicks Eye/EyeOff button
UI->>Store: NEW: setHideEmpty(!hideEmpty)
Store-->>UI: confirm toggle
Note over UI,Cache: Re-render with filter applied
UI->>Cache: NEW: useMemo recomputes dataConnections
Cache->>Cache: NEW: filterEmptyDatabases() applied per connection
alt hideEmpty === false
Cache-->>UI: return rawConnections unchanged
else hideEmpty === true
Note over Cache: For each connection.databases:
Cache->>Cache: filter schemas with 0 tables
Cache->>Cache: filter databases where all schemas are empty
alt database.schemas.length === 0
Note over Cache: preserve - lazy state
end
Cache-->>UI: filteredConnections
end
alt filteredConnections changed
UI->>UI: re-render tree with filtered data
else no change (immuatable check)
UI->>UI: return previous reference
end
Note over UI,Backend: Unchanged Backend Behavior
Note over Backend: CHANGED: get_schemas() no longer filters empty schemas server-side
Note over Backend: now returns ALL schemas regardless of table count
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| continue; | ||
| } | ||
| const nonEmptySchemas = database.schemas.filter( | ||
| (schema) => schema.tables.length > 0, |
Contributor
There was a problem hiding this comment.
P1: The new empty-schema filter treats tables.length === 0 as definitively empty, but 0 is also the lazy-loading state. This can hide schemas/databases before table fetches run, preventing users from ever loading their tables.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/datasources/datasources.tsx, line 156:
<comment>The new empty-schema filter treats `tables.length === 0` as definitively empty, but `0` is also the lazy-loading state. This can hide schemas/databases before table fetches run, preventing users from ever loading their tables.</comment>
<file context>
@@ -116,6 +124,51 @@ const sortedTablesAtom = atom((get) => {
+ continue;
+ }
+ const nonEmptySchemas = database.schemas.filter(
+ (schema) => schema.tables.length > 0,
+ );
+ if (nonEmptySchemas.length === 0) {
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Closes #6807.
This toggles empty db and schemas. By default all are shown, this config is stored in local storage.
Screen.Recording.2026-05-28.at.5.35.47.PM.mov
📋 Pre-Review Checklist
✅ Merge Checklist