aboutsummaryrefslogtreecommitdiff
path: root/src/components/PollsList/PollsList.tsx
diff options
context:
space:
mode:
authorilyayudovin <ilyayudovin123@gmail.com>2020-09-19 01:12:34 +0300
committereug-vs <eug-vs@keemail.me>2020-10-08 22:05:52 +0300
commit3aa75f9454332342fdb76d3b8466ef52f058cf4d (patch)
treec0535f559f77566f31e9de696f3c48ead89a1d71 /src/components/PollsList/PollsList.tsx
parent13fc0cc8ffb61d8f184707feed1f9010798c45f1 (diff)
downloadwhich-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.tsx6
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}