FIX: Unsubscribe from the `/reviewable_counts` channel when leaving the review-index route (#17778)
Follow-up to ce9eec8606
.
When the review-index route is entered, we listen to the `/reviewable_counts` (or `/reviewable_counts/<user_id>` when the new user menu is enabled) channel so we can listen for changes to reviewables and update the UI accordingly. However, we currently don't unsubscribe when leaving the route which means each time the route is entered, we setup a new listener causing the browser to do unnecessary work and potentially state leakage.
This commit is contained in:
parent
0e6f9ef406
commit
3d7829c01f
|
@ -82,6 +82,10 @@ export default DiscourseRoute.extend({
|
|||
|
||||
deactivate() {
|
||||
this.messageBus.unsubscribe("/reviewable_claimed");
|
||||
const channel = this.currentUser.enable_redesigned_user_menu
|
||||
? `/reviewable_counts/${this.currentUser.id}`
|
||||
: "/reviewable_counts";
|
||||
this.messageBus.unsubscribe(channel);
|
||||
},
|
||||
|
||||
@action
|
||||
|
|
Loading…
Reference in New Issue