Skip to content

Per-session workbar collapse (split from #4654) #4693

Description

@liuxiaocs7

Problem

The session workbar keeps a single app-global collapsed flag (rightCollapsed in workbar-layout.ts, persisted under maka-session-workbar-collapsed-v1). Opening the side panel in conversation A therefore carries straight into a brand-new conversation B — the panel appears expanded for a session that never opened it.

This was item 3 of #4654. It was split out of #4655 (which fixes the first two items — immediate side-conversation message + progress) because it needs a product decision and a cleaner implementation than the first attempt.

Decision needed

Should per-session workbar collapse persist across app restart, or be process-scoped?

  • The current persisted key is app-global. A per-session mirror that is in-memory silently downgrades that persisted preference (after restart it is empty, defaults to collapsed, and overwrites the stored value before it is read) and leaves the old key unreachable but still written.
  • Either answer is fine, but the superseded key has to move or go with it.

Suggested implementation

Hold the session key in the layout reducer rather than mirror it in the controller:

  • useWorkbarLayoutState is called by the controller, which knows activeSessionId; pass it in, hold collapsedBySession, and derive rightCollapsed from it.
  • This removes the need for a separate Map + guard ref + bidirectional sync effects, and lets a single key own the fact.
  • Evict entries for deleted sessions (the controller already has authoritativeSessionIds on hand, as it uses it to clean up terminals) so the map is bounded.

Note

"A new conversation starts clean" only holds for the collapse bit; the panel topology is still app-global and persisted under maka-session-workbar-panels-v3 (with session-private tabs projected out). Decide whether that split is intended or whether topology should also be per-session.

Refs #4654

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions