Skip to content

Commit

Permalink
improve effect dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
GypsyDangerous committed Aug 19, 2020
1 parent ddd089e commit 49f7cd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,13 @@ function App(props) {
socket.emit("addme", channel);
}
}
}, [channel, socket]);
}, [channel, socket]);

const ReverseMessageOrder = settings?.ReverseMessageOrder

useEffect(() => {
setTimeout(() => {
if (settings?.ReverseMessageOrder) {
if (ReverseMessageOrder) {
bodyRef.current.scrollTo({
top: bodyRef.current.scrollHeight,
// behavior: "smooth",
Expand All @@ -454,7 +456,7 @@ function App(props) {
});
}
}, 100);
}, [settings.ReverseMessageOrder]);
}, [ReverseMessageOrder]);

const handleSearch = useCallback(setSearch, []);

Expand Down

0 comments on commit 49f7cd6

Please sign in to comment.