You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1] [arch] AdminPanel.tsx + UserManagement.tsx import each other — no shared admin store #442
[P1] [arch] AdminPanel.tsx + UserManagement.tsx import each other — no shared admin/ index, no shared state hook
Context
AdminPanel.tsx:1-20 imports UserManagement. AdminPanel.tsx:38-65 manages 4 tabs with inline ternary render. type: 'admin' in editorStore (editorStore.ts:174-193).
Problem
Per docs/audits/admin.md F14.
Admin has 4 tabs (Process List, Server Variables, Server Status, Users), 3 inline in AdminPanel.tsx, 1 in separate file. The AdminPanel.tsx is the outermost shell only because user-management couldn't fit in one file. ARCHITECTURE §3.7 implies one-domain-per-store; admin has 4 domains but 0 stores — all state lives in 4 sub-components.
Files
src/components/admin/AdminPanel.tsx:1-20, 38-65
Repro (if applicable)
Static analysis only.
Expected
useAdminStore.getState().loadProcesses('conn-1') callable from anywhere; admin tabs share polling state (one process_list_update subscription per connection); AdminPanel.tsx is tab bar + content area only, ≤ 100 LOC.
Proposed fix
Scope L. (1) Create src/stores/adminStore.ts with processes, variables, status, users slices. (2) Split AdminPanel.tsx into 4 files. (3) <AdminPanelRouter> for tab routing.
Acceptance
Per-domain store exists; AdminPanel.tsx ≤ 100 LOC.
There is no circular import. UserManagement.tsx contains no reference to AdminPanel at all:
$ grep -n "AdminPanel" src/components/admin/UserManagement.tsx
(no matches)
The dependency is one-directional — AdminPanel.tsx:20 imports UserManagement, and nothing goes back the other way.
What remains of this issue is the second half of the title: there is no shared admin store, so both components fetch and hold their own copies of the same server state (SHOW GRANTS is issued separately by GrantsView and again by PrivilegesEditor for the same user). That is worth addressing, but it is a duplication-of-state argument rather than a dependency-cycle one, and it overlaps heavily with #432.
Suggest either retitling to "admin components each fetch their own copy of the same server state — no shared store" and dropping the cycle claim, or closing this and folding the point into #432.
Closing as not planned. Two of the three claims don't hold, and the third is already done.
"AdminPanel.tsx + UserManagement.tsx import each other." They don't. AdminPanel imports UserManagement; UserManagement imports nothing from AdminPanel — 0 matches for import.*AdminPanel across the directory. It's an ordinary parent-child relationship, and there is no cycle to break.
"AdminPanel.tsx is tab bar + content area only, ≤ 100 LOC." Done in #619. It's 71 lines, now with six tabs rather than four.
"Admin tabs share polling state (one process_list_update subscription per connection)." They can't. AdminPanel renders the active tab only — six activeSubTab === … && guards — so at most one poller exists at a time regardless of how many tabs or connections are open. There is no shared state to put in a store.
That leaves a store whose every slice would have exactly one consumer, which is the shape #448 turned out to be: an abstraction that reads as centralising and is really just indirection. AdminPanel.tsx records where that reasoning changes — something outside the panel wanting the process list — so the next reader doesn't re-derive it.
The underlying complaint (four domains, one 793-line file) was real and is fixed: #619 and #620 split six tabs into six files plus three testable modules, and no admin file is over 520 lines.
Activity
EVWorth commentedon Aug 29, 2026
The stated defect does not exist
There is no circular import.
UserManagement.tsxcontains no reference toAdminPanelat all:The dependency is one-directional —
AdminPanel.tsx:20importsUserManagement, and nothing goes back the other way.What remains of this issue is the second half of the title: there is no shared admin store, so both components fetch and hold their own copies of the same server state (
SHOW GRANTSis issued separately byGrantsViewand again byPrivilegesEditorfor the same user). That is worth addressing, but it is a duplication-of-state argument rather than a dependency-cycle one, and it overlaps heavily with #432.Suggest either retitling to "admin components each fetch their own copy of the same server state — no shared store" and dropping the cycle claim, or closing this and folding the point into #432.
refactor(admin): one file per tab, instead of three tabs in one (#619)
EVWorth commentedon Sep 10, 2026
Closing as not planned. Two of the three claims don't hold, and the third is already done.
"AdminPanel.tsx + UserManagement.tsx import each other." They don't.
AdminPanelimportsUserManagement;UserManagementimports nothing fromAdminPanel— 0 matches forimport.*AdminPanelacross the directory. It's an ordinary parent-child relationship, and there is no cycle to break."AdminPanel.tsx is tab bar + content area only, ≤ 100 LOC." Done in #619. It's 71 lines, now with six tabs rather than four.
"Admin tabs share polling state (one
process_list_updatesubscription per connection)." They can't.AdminPanelrenders the active tab only — sixactiveSubTab === … &&guards — so at most one poller exists at a time regardless of how many tabs or connections are open. There is no shared state to put in a store.That leaves a store whose every slice would have exactly one consumer, which is the shape #448 turned out to be: an abstraction that reads as centralising and is really just indirection.
AdminPanel.tsxrecords where that reasoning changes — something outside the panel wanting the process list — so the next reader doesn't re-derive it.The underlying complaint (four domains, one 793-line file) was real and is fixed: #619 and #620 split six tabs into six files plus three testable modules, and no admin file is over 520 lines.