about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/intersection_observer_article.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-09-26 20:57:07 +0200
committerGitHub <noreply@github.com>2020-09-26 20:57:07 +0200
commitff89025979abf3dae40b8e0745b2584cc3feb744 (patch)
treefd7650bee5e553a42b5160ecf5e645587c41e4dc /app/javascript/mastodon/components/intersection_observer_article.js
parent03b6b034b95b9ee2ce4a80c3b9c724273dcb0072 (diff)
Add unread notification markers (#14818)
* Add unread notification markers

Fixes #14804

* Allow IntersectionObserverArticle's children to be updated
Diffstat (limited to 'app/javascript/mastodon/components/intersection_observer_article.js')
-rw-r--r--app/javascript/mastodon/components/intersection_observer_article.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/javascript/mastodon/components/intersection_observer_article.js b/app/javascript/mastodon/components/intersection_observer_article.js
index 124b34b02..2d87f19b5 100644
--- a/app/javascript/mastodon/components/intersection_observer_article.js
+++ b/app/javascript/mastodon/components/intersection_observer_article.js
@@ -2,10 +2,7 @@ import React from 'react';
 import PropTypes from 'prop-types';
 import scheduleIdleTask from '../features/ui/util/schedule_idle_task';
 import getRectFromEntry from '../features/ui/util/get_rect_from_entry';
-import { is } from 'immutable';
 
-// Diff these props in the "rendered" state
-const updateOnPropsForRendered = ['id', 'index', 'listLength'];
 // Diff these props in the "unrendered" state
 const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight'];
 
@@ -33,9 +30,12 @@ export default class IntersectionObserverArticle extends React.Component {
       // If we're going from rendered to unrendered (or vice versa) then update
       return true;
     }
-    // Otherwise, diff based on props
-    const propsToDiff = isUnrendered ? updateOnPropsForUnrendered : updateOnPropsForRendered;
-    return !propsToDiff.every(prop => is(nextProps[prop], this.props[prop]));
+    // If we are and remain hidden, diff based on props
+    if (isUnrendered) {
+      return !updateOnPropsForUnrendered.every(prop => nextProps[prop] === this.props[prop]);
+    }
+    // Else, assume the children have changed
+    return true;
   }
 
   componentDidMount () {