From 2a43b5935d68c906dd375171d308f6441bc6fce3 Mon Sep 17 00:00:00 2001 From: ShimaginAndrey Date: Mon, 16 Aug 2021 16:55:24 +0300 Subject: [PATCH] [SSE] Fix re-render FilterOptions --- .../mobile/src/view/FilterOptions.jsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/view/FilterOptions.jsx b/apps/spreadsheeteditor/mobile/src/view/FilterOptions.jsx index 621b5afb9..7e4e30d31 100644 --- a/apps/spreadsheeteditor/mobile/src/view/FilterOptions.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/FilterOptions.jsx @@ -6,17 +6,11 @@ import { Device } from '../../../../common/mobile/utils/device'; const FilterOptions = (props) => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); - - useEffect(() => { - const is_all_checked = props.listVal.every(item => item.check); - setAll(is_all_checked); - }); - - const [all, setAll] = useState(false); + let is_all_checked = props.listVal.every(item => item.check); const HandleClearFilter = () => { + is_all_checked = true; props.onClearFilter(); - setAll(true); props.onUpdateCell('all', true); }; @@ -51,7 +45,7 @@ const FilterOptions = (props) => { props.onDeleteFilter()} id="btn-delete-filter">{_t.textDeleteFilter} - props.onUpdateCell('all', e.target.checked)} name='filter-cellAll' checkbox checked={all}>{_t.textSelectAll} + props.onUpdateCell('all', e.target.checked)} name='filter-cellAll' checkbox checked={is_all_checked}>{_t.textSelectAll} {props.listVal.map((value) => props.onUpdateCell(value.id, e.target.checked)} key={value.value} name='filter-cell' value={value.value} title={value.cellvalue} checkbox checked={value.check} /> )}