discourse/app/assets/javascripts
Alan Guo Xiang Tan 18c542dc02
PERF: Avoid triggering TopicTrackingState change callbacks unnecessarily (#21425)
What is the problem?

The TopicTrackingState is a service on the client side that is used to store
state of topics which is new or has unread posts for a given user. The state
is updated via various means and the one in concern here is whenever we load
a new topic list from the server. When a topic list is loaded from the server,
we sync this new topic list with the states in TopicTrackingState. There is also
a hard limit on the number of states that is stored by TopicTrackingState for
performance reasons and the limit is currently set to 4000. It was noticed that
once this limit has been reached, syncing a topic list with TopicTrackingState can
result in the registered state change callbacks to be called unnecessarily. This
is because during `TopicTrackingState#sync` we call `TopicTrackingState#removeTopic`
if the topic in question is neither new or unread to a user. However, `TopicTrackingState#removeTopic`
would call `TopicTrackingState#_afterStateChange` even if nothing was removed.

What is the fix?

This commit fixes the problem by checking that `TopicTrackingState#_afterStateChange` is only
called in `TopicTrackingState#removeTopic` when a topic is actually removed.
2023-05-08 13:26:28 +10:00
..
admin Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
bootstrap-json Build(deps): Bump node-fetch from 3.3.0 to 3.3.1 in /app/assets/javascripts (#20655) 2023-03-13 08:45:43 +08:00
confirm-new-email DEV: Add error message styling (#21225) 2023-04-25 08:40:18 -04:00
dialog-holder Build(deps): Bump webpack in /app/assets/javascripts (#21376) 2023-05-04 10:51:39 +02:00
discourse PERF: Avoid triggering TopicTrackingState change callbacks unnecessarily (#21425) 2023-05-08 13:26:28 +10:00
discourse-common Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
discourse-hbr Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
discourse-plugins Build(deps): Bump @babel/core in /app/assets/javascripts (#21349) 2023-05-04 11:30:57 +02:00
discourse-widget-hbs Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
docs
ember-addons
ember-cli-progress-ci DEV: Add progress output in CI during ember-cli build (#17977) 2022-08-17 22:39:52 +01:00
ember-production-deprecations DEV: Include ember deprecation messages in production builds (#20587) 2023-03-10 10:37:28 +00:00
locales UX/DEV: Review queue redesign fixes (#20239) 2023-03-02 16:40:53 +01:00
patches DEV: Update ember-cli to 4.12.0 (#21074) 2023-04-19 12:58:29 +02:00
pretty-text Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
select-kit Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
truth-helpers Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
wizard Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00
.licensee.json Revert "DEV: Merge package.json files (#21172)" (#21182) 2023-04-20 14:57:40 +02:00
.npmrc
discourse-js-processor.js DEV: Update ember-cli-htmlbars to 6.2.0 (#20467) 2023-02-27 18:43:28 +01:00
handlebars-shim.js
package.json DEV: Move app build-time dependencies to devDependencies (#21310) 2023-05-03 09:25:13 +01:00
polyfills.js Drop support for iOS < 15.7 (#19847) 2023-01-16 17:28:59 +00:00
service-worker.js.erb FIX: Service worker should cache only 200 requests (#21409) 2023-05-05 11:33:47 -04:00
yarn.lock Build(deps): Bump ember-source in /app/assets/javascripts 2023-05-05 12:56:24 +01:00