From 091ac9b4c1ee10f194e9b0e8e3765186ac63e125 Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Mon, 20 Jan 2020 18:27:08 +0300 Subject: [PATCH] Add shallow equality --- frontend/app/components/thread/thread.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/thread/thread.tsx b/frontend/app/components/thread/thread.tsx index a1e981e9..fc36911d 100644 --- a/frontend/app/components/thread/thread.tsx +++ b/frontend/app/components/thread/thread.tsx @@ -1,6 +1,6 @@ /** @jsx createElement */ import { createElement, FunctionComponent } from 'preact'; -import { useSelector, useDispatch } from 'react-redux'; +import { useSelector, useDispatch, shallowEqual } from 'react-redux'; import { useCallback } from 'preact/hooks'; import b from 'bem-react-helper'; @@ -32,7 +32,7 @@ const commentSelector = (id: string) => (state: StoreState) => { export const Thread: FunctionComponent = ({ id, level, mix, getPreview }) => { const dispatch = useDispatch(); - const { collapsed, comment, childs, theme } = useSelector(commentSelector(id)); + const { collapsed, comment, childs, theme } = useSelector(commentSelector(id), shallowEqual); const collapse = useCallback(() => { dispatch(setCollapse(id, !collapsed)); }, [id, collapsed]);