Fix inf. markAsRead by wrapping useEffect around it (breaks the view whenever a connection is closed from chats-view)
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { useHistory, Link } from "react-router-dom";
import { useSelector, useDispatch } from "react-redux";
@@ -38,6 +38,8 @@ export default function WonConnectionSelectionItem({
);
const isUnread = connectionUtils.isUnread(connection);
+ useEffect(
+ () => {
if (isUnread && openConnectionUri === connectionUri) {
dispatch(
actionCreators.connections__markAsRead({
@@ -45,6 +47,9 @@ export default function WonConnectionSelectionItem({
})
);
}
+ },
+ [connection, openConnectionUri]
+ );
const closeButton = targetAtomFailedToLoad ? (
<button
