Skip to content

fix(comments): recreate comment editor on Activity tab remount - #63505

Open
jospoortvliet wants to merge 1 commit into
masterfrom
fix/comments-activity-tab-remount
Open

fix(comments): recreate comment editor on Activity tab remount#63505
jospoortvliet wants to merge 1 commit into
masterfrom
fix/comments-activity-tab-remount

Conversation

@jospoortvliet

Copy link
Copy Markdown
Member

Summary

Fixes #63487

The comment field at the top of the Activity/Comments sidebar tab disappeared after switching away and back, and only came back after a full page reload.

Root cause

apps/comments/src/comments-activity-tab.ts mounts the comment editor into the Activity sidebar's registerSidebarAction. The Vue app instance is stored in a closure variable and intended to be reused across mount/unmount cycles (switching tabs). unmount() calls app.unmount(), destroying the instance, but never clears the variable. On the next mount(), the (still truthy) app check prevents a new instance from being created, and .mount(el) is called on an already-destroyed Vue app — which is a no-op. Reloading the page resets module state, which is why that "fixed" it.

Confirmed this only affects the Activity-integrated path: with the Activity app disabled, the plain "Comments" tab (a separate defineCustomElement-based mount in FilesSidebarTab.vue) is unaffected.

Fix

Reset app = undefined after app?.unmount() so the next mount() call recreates the Vue app instance instead of reusing a dead one.

Test plan

  • Enable Activity app, open sidebar → Activity tab, confirm comment field is visible
  • Switch to Versions (or another file), switch back to Activity tab, confirm comment field is still there without reloading
  • Repeat a few times to make sure it doesn't regress after multiple tab switches

Assisted-by: Claude:claude-sonnet-5

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes - didn't bother, it's just that it now doesn't disappear...
  • Documentation (manuals or wiki) has been updated or is not required
  • Backports requested where applicable (ex: critical bugfixes)
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component)
  • Milestone added for target branch/version (ex: 32.x for stable32)

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…ment editor

The comment editor Vue app instance was kept in a closure variable and
reused across Activity tab mount/unmount cycles. unmount() destroyed
the app via app.unmount() but never reset the variable, so the next
mount() skipped creating a new app and called mount() on an already-
destroyed instance — a silent no-op. This made the comment field
disappear after leaving and returning to the Activity tab, only
recoverable via a full page reload.

Reset `app` to undefined after unmounting so the editor is recreated
on the next mount.

Fixes #63487

Assisted-by: Claude:claude-sonnet-5

Signed-off-by: Jos Poortvliet <jospoortvliet@gmail.com>
@jospoortvliet
jospoortvliet requested a review from a team as a code owner August 23, 2026 14:16
@jospoortvliet jospoortvliet added 3. to review Waiting for reviews papercut Annoying recurring UX issue with possibly simple fix. feature: comments labels Aug 23, 2026
@jospoortvliet
jospoortvliet requested review from kristian-zendato, skjnldsv and sorbaugh and removed request for a team August 23, 2026 14:16
@jospoortvliet jospoortvliet added the feature: file sidebar Related to the file sidebar component label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted bug feature: comments feature: file sidebar Related to the file sidebar component papercut Annoying recurring UX issue with possibly simple fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Comment entry field disappears when switching tabs in sidebar

2 participants