This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
Alan Guo Xiang Tan c245b74398
FIX: Avoid leaking TopicTrackingState listeners due to sidebar (#18131)
In eb12daa7f8 when adding community
section support for anonymous users, we changed the `sectionLinks`
property into a getter method. This meant that if the getter method was
called again after the community section has been rendered, we would end
up reintializing the section links classes. As part of the
initialisation, some section links would setup a TopicTrackingState
onStateChange listener. However, the listener is only removed when the
entire community section is removed which resulted in us leaking the
onStateChange listeners.

This commit reverts the `sectionLinks` from being defined as a getter
method into a property which is only set once when the community section
is being constructor. Also, we changed it such that the community
section will register the listener instead of each section link since it
makes cleaning up much easier to reason about.

No tests have been added for this commit because the original bug is
not possible after this change and we already have an existing tests
ensuring that TopicTrackingState change listeners are cleaned up when
the community section is destroyed.

Internal ref: /t/73224
2022-08-30 11:39:32 +08:00
..
app FIX: Avoid leaking TopicTrackingState listeners due to sidebar (#18131) 2022-08-30 11:39:32 +08:00
config DEV: Enable jquery-integration runtime deprecation (#18057) 2022-08-23 19:28:22 +01:00
lib DEV: Compile markdown-it-bundle with ember-cli (#18104) 2022-08-29 19:11:59 +01:00
public/assets/scripts DEV: Enable jquery-integration runtime deprecation (#18057) 2022-08-23 19:28:22 +01:00
scripts COPY: Change "old" to "unsupported" browser (#17555) 2022-07-18 19:32:04 +03:00
tests DEV: Use all unread notifications count for the count in document title (#18120) 2022-08-30 05:37:03 +03:00
.ember-cli REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
.npmrc DEV: Prevent npm usage (#13945) 2021-08-04 22:04:58 +02:00
ember-cli-build.js DEV: Compile markdown-it-bundle with ember-cli (#18104) 2022-08-29 19:11:59 +01:00
jsconfig.json DEV: Add jsconfig (#17800) 2022-08-04 22:50:47 +01:00
package.json DEV: Support inline-hbs compilation in themes (#18112) 2022-08-29 19:53:42 +01:00
testem.js DEV: Introduce flag for compiling Plugin JS with Ember CLI (#17965) 2022-08-22 09:56:39 +01:00