Skip to content

[P1] [arch] AdminPanel.tsx + UserManagement.tsx import each other — no shared admin store #442

Closed as not planned

Description

@EVWorth

[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.

Needs human verify

No (visual + tests)

Labels: audit, area/admin, severity/p1, kind/arch

Activity

  1. added
    audit
    severity/p1
    kind/arch
    area/admin
    on Jul 31, 2026
  2. EVWorth commented on Aug 29, 2026

    @EVWorth
    OwnerAuthor

    The stated defect does not exist

    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.

  3. EVWorth commented on Sep 10, 2026

    @EVWorth
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adminauditkind/archseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions