From 6f08985996e0c1f212e613beb35fe15ab4bbaf6c Mon Sep 17 00:00:00 2001 From: Jycssu Date: Wed, 22 Nov 2023 15:57:11 +0100 Subject: [PATCH] chore: avoid hydratation error on dev when filters are actives --- .../assetsView/filters/AssetsViewFilterButton.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/assetsView/filters/AssetsViewFilterButton.tsx b/src/components/assetsView/filters/AssetsViewFilterButton.tsx index 388e5f5..a27c1ac 100644 --- a/src/components/assetsView/filters/AssetsViewFilterButton.tsx +++ b/src/components/assetsView/filters/AssetsViewFilterButton.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react' +import { FC, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { Button, Indicator } from '@mantine/core' @@ -15,7 +15,11 @@ export const AssetsViewFilterButton: FC = () => { }) const modals = useModals() const [currentFilter] = useAtom(assetsViewFilterAtom) - const hasActiveFilter = !_isEqual(currentFilter, assetsViewDefaultFilter) + const [hasActiveFilter, setHasActiveFilter] = useState(false) + + useEffect(() => { + setHasActiveFilter(!_isEqual(currentFilter, assetsViewDefaultFilter)) + }) function openModal() { modals.openContextModal('assetsViewFilterModal', { innerProps: {} })