diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-09-19 01:12:34 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-10-08 22:05:52 +0300 |
commit | 3aa75f9454332342fdb76d3b8466ef52f058cf4d (patch) | |
tree | c0535f559f77566f31e9de696f3c48ead89a1d71 /src/components/PollsList/PollsList.tsx | |
parent | 13fc0cc8ffb61d8f184707feed1f9010798c45f1 (diff) | |
download | which-ui-3aa75f9454332342fdb76d3b8466ef52f058cf4d.tar.gz |
clear cache on polls size change
Diffstat (limited to 'src/components/PollsList/PollsList.tsx')
-rw-r--r-- | src/components/PollsList/PollsList.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/PollsList/PollsList.tsx b/src/components/PollsList/PollsList.tsx index bf2079a..3eeed2b 100644 --- a/src/components/PollsList/PollsList.tsx +++ b/src/components/PollsList/PollsList.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState, useMemo } from 'react'; +import React, {useCallback, useState, useMemo, useRef, useEffect} from 'react'; import { WindowScroller, AutoSizer, @@ -25,6 +25,10 @@ const PAGE_SIZE = 10; const PollsList: React.FC<PropTypes> = ({ polls, mutate }) => { const [displayCount, setDisplayCount] = useState<number>(PAGE_SIZE); + useEffect(()=> { + cache.clearAll(); + },[polls]); + const rowRenderer = useCallback(({ index, style, key, parent }) => ( <RenderItem polls={polls} |