Skip to content

DB Access: adopt fine-grained session-scoped view state #178

Description

@aimeritething

Problem

DB Access currently uses two different state-management shapes:

  • the session shell uses a session-scoped Jotai store with separate atoms;
  • SQL table, MongoDB collection, and find views expose broad React contexts containing combined { state, actions } values.

The broad view contexts make unrelated consumers update together. Small interaction-state changes can therefore invalidate data grids, toolbars, headers, or document lists that do not use the changed field.

Goal

Align DB Access data views with a clear ownership model:

  • shared cross-component interaction state uses fine-grained, session-scoped Jotai atoms;
  • component-private state remains local to the smallest owning subtree;
  • frame-by-frame DOM interaction state stays in refs/CSS rather than React or Jotai;
  • derived data is computed from source state rather than stored redundantly.

State boundaries

Define and apply ownership for at least:

  • table and collection pagination, sorting, visibility, and committed presentation preferences;
  • active tab/object identity and per-object state isolation;
  • find search term and current match;
  • component-local menus and dialogs;
  • query results and derived rendered rows/documents;
  • live pointer/resize state.

Shared view state must be keyed by a stable tab or object identity so switching between tables or collections cannot leak state across views.

Requirements

  • Do not replace a broad React context with one broad atom.
  • Consumers subscribe only to the atoms or derived atoms they need.
  • Preserve the existing DB Access session-scoped store boundary.
  • Define cleanup or retention behavior when tabs close and services switch.
  • Keep server/query data ownership separate from interaction-state ownership.
  • Preserve current user-visible behavior.
  • Add focused tests for state isolation and subscription boundaries.
  • Document the resulting state-ownership convention near the DB Access state module.

Non-goals

  • Visual redesign.
  • Database transport or API changes.
  • Scroll/backdrop rendering changes.
  • Reworking the per-cell find matching algorithm.
  • Implementing frame-by-frame column resize mechanics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions