Skip to content

refactor: declare session.sessionId in the menu callback deps - #370

Merged
RAIT-09 merged 1 commit into
devfrom
refactor/menu-session-dep
Jul 17, 2026
Merged

refactor: declare session.sessionId in the menu callback deps#370
RAIT-09 merged 1 commit into
devfrom
refactor/menu-session-dep

Conversation

@RAIT-09

@RAIT-09 RAIT-09 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Description

The More menu callback reads session.sessionId from its closure for the Rename session item, but does not declare it as a dependency. It stays fresh today only because handleNewChat — a declared dep — depends on the whole session object, so any session change recreates the menu callback transitively. If handleNewChat's deps are ever narrowed to individual fields (the codebase's preferred pattern), Rename would silently start writing titles to a previous session's saved entry.

This declares session.sessionId in the deps so the freshness is self-contained. No behavior or performance change: sessionId never changes without the session object identity changing, so the callback is already rebuilt in exactly these cases.

Related issue

None.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other

Checklist

  • npm run lint passes ("Use sentence case for UI text" warnings are acceptable for brand names)
  • npm run build passes
  • Tested in Obsidian
  • Existing functionality still works
  • Documentation updated if needed (N/A)

Testing environment

  • Agent: Claude Code. Verified: More menu renames the current session correctly in sidebar, floating, and embedded variants, including right after "New chat"
  • OS: macOS

Screenshots

N/A

Summary by CodeRabbit

  • Bug Fixes
    • Updated the floating header menu to stay synchronized when the active session changes.
    • Ensured session actions, such as renaming, use the current session correctly.

…deps

The More menu's rename item reads session.sessionId from the closure,
but its freshness relied on handleNewChat depending on the whole
session object; narrowing that dep would silently rename a stale
session. Behavior is unchanged today.
@RAIT-09 RAIT-09 self-assigned this Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 52acc6c4-4610-40a2-abea-62ed6e0148cc

📥 Commits

Reviewing files that changed from the base of the PR and between 2484b31 and 1dbf730.

📒 Files selected for processing (1)
  • src/ui/ChatPanel.tsx

📝 Walkthrough

Walkthrough

The ChatPanel floating menu callback now includes session.sessionId in its dependency array, keeping callback-generated menu content tied to the active session.

Changes

Floating menu synchronization

Layer / File(s) Summary
Track the active session identifier
src/ui/ChatPanel.tsx
The handleShowFloatingMenu callback dependency array now includes session.sessionId.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

A bunny checked the menu bright,
And found the session needed right.
One dependency joined the queue,
So names stay fresh as sessions do.
Hop, hop—no stale id in sight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding session.sessionId to the menu callback dependencies.
Description check ✅ Passed The description includes all required template sections and fills in the key details, testing, and environment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/menu-session-dep

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@RAIT-09
RAIT-09 merged commit 021ddde into dev Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant