Skip to content

bug: context note does not update when a tab in a split view is closed or a split pane is removed #273

Description

@donivatamazondotcom

Summary

In a split-view layout, closing a tab in one split pane or removing a split pane does not reliably refresh the context note badge. The badge continues to show the closed or no-longer-focused note instead of reflecting the new active state.

Possibly related to #265 (stale badge after closing last markdown note), but the mechanism may be distinct — this involves transitioning between focused panes rather than closing the last markdown file. Root cause not fully confirmed; filing as a separate issue so the repro is captured while investigation continues.

Repro scenarios

Multiple variants observed. All show the same stale-badge symptom.

Variant A: Split with two markdown tabs, close one.

  1. Open the ACP chat panel.
  2. Split the editor (e.g., Cmd+Shift+\ or drag a tab) so two markdown panes are visible side by side, each with its own markdown note.
  3. Close the tab in one of the split panes (via tab ×, Cmd+W, or context menu).
  4. Observe the context badge.

Expected: Badge updates to reflect the surviving pane's active note.

Actual: Badge may continue to show the closed pane's note, or stay on whichever note was focused prior to the close.

Variant B: Split pane is collapsed.

  1. Set up a split with two markdown panes as above.
  2. Close all tabs in one of the panes, causing that entire split pane to disappear.
  3. Observe the context badge.

Expected: Badge reflects the remaining pane's active note.

Actual: Badge stays on the previous note from the removed pane.

Suspected mechanism

The active-leaf-change event behavior may differ when a leaf is destroyed (via pane/tab close) versus when focus moves between existing leaves. Possibilities under investigation:

  • Event may fire with the wrong target leaf, or not fire at all on pane-collapse.
  • The listener in attachToView may be invoked with the old view during the destroy phase, before the new active leaf is resolved.

I haven't yet confirmed whether the two-part fix proposed in #265 addresses these cases — I plan to test once the #265 fix is cherry-picked into a local build.

Next steps

  1. Reproduce on the fix/context-note-stale-on-close branch to determine whether bug: context note does not update when the active note is closed (stays stale) #265's fix already covers these cases.
  2. If covered, I'll add these as test cases / additional repros to the bug: context note does not update when the active note is closed (stays stale) #265 PR.
  3. If not covered, I'll narrow the mechanism (likely an event-firing edge case on pane destroy) and propose a targeted fix.

Filing now so the symptoms are captured and discoverable.

Environment

  • Obsidian 1.12.x
  • Plugin version: latest dev (b57ab6c at time of report)
  • Reproduced on macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions