REFACTOR: Remove `_.isEqual`

REFACTOR: Remove _.isEqual

diff --git a/app/assets/javascripts/discourse-common/addon/lib/object.js b/app/assets/javascripts/discourse-common/addon/lib/object.js
index c9f0e40..b34594e 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/object.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/object.js
@@ -1,7 +1,9 @@
 // a fairly simple deep merge based on: https://gist.github.com/ahtcx/0cd94e62691f539160b32ecda18af3d6
-export function merge(...objects) {
-  const isObject = obj => obj && typeof obj === "object";
+function isObject(obj) {
+  return obj && typeof obj === "object";
+}
 
+export function merge(...objects) {
   function deepMergeInner(target, source) {
     Object.keys(source).forEach(key => {
       const targetValue = target[key];
@@ -35,3 +37,19 @@ export function merge(...objects) {
 
   return target;
 }
+
+export function deepEqual(obj1, obj2) {
+  if (obj1 === obj2) {
+    return true;
+  } else if (isObject(obj1) && isObject(obj2)) {
+    if (Object.keys(obj1).length !== Object.keys(obj2).length) {
+      return false;
+    }
+    for (var prop in obj1) {
+      if (!deepEqual(obj1[prop], obj2[prop])) {
+        return false;
+      }
+    }
+    return true;
+  }
+}
diff --git a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
index 7b98945..e179857 100644
--- a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
+++ b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
@@ -5,6 +5,7 @@ import discourseComputed, { on } from "discourse-common/utils/decorators";
 import PreloadStore from "discourse/lib/preload-store";
 import Category from "discourse/models/category";
 import User from "discourse/models/user";
+import { deepEqual } from "discourse-common/lib/object";
 
 function isNew(topic) {
   return (
@@ -115,7 +116,7 @@ const TopicTrackingState = EmberObject.extend({
       if (["new_topic", "unread", "read"].includes(data.message_type)) {
         tracker.notify(data);
         const old = tracker.states["t" + data.topic_id];
-        if (!_.isEqual(old, data.payload)) {
+        if (!deepEqual(old, data.payload)) {
           tracker.states["t" + data.topic_id] = data.payload;
           tracker.notifyPropertyChange("states");
           tracker.incrementMessageCount();
diff --git a/app/assets/javascripts/discourse/app/routes/build-topic-route.js b/app/assets/javascripts/discourse/app/routes/build-topic-route.js
index a652b39..c523355 100644
--- a/app/assets/javascripts/discourse/app/routes/build-topic-route.js
+++ b/app/assets/javascripts/discourse/app/routes/build-topic-route.js
@@ -11,6 +11,7 @@ import Session from "discourse/models/session";
 import { Promise } from "rsvp";
 import Site from "discourse/models/site";
 import { inject as service } from "@ember/service";
+import { deepEqual } from "discourse-common/lib/object";
 
 // A helper to build a topic route for a filter
 function filterQueryParams(params, defaultParams) {
@@ -39,7 +40,7 @@ function findTopicList(store, tracking, filter, filterParams, extras) {
         cachedList &&
         cachedList.get("filter") === filter &&
         (cachedList.get("topics.length") || 0) > cachedList.get("per_page") &&
-        _.isEqual(cachedList.get("listParams"), filterParams)
+        deepEqual(cachedList.get("listParams"), filterParams)
       ) {
         cachedList.set("loaded", true);
 

GitHub sha: f365d463

This commit appears in #10566 which was merged by eviltrout.