diff options
Diffstat (limited to 'src/components/PollsList')
-rw-r--r-- | src/components/PollsList/PollsList.tsx | 8 | ||||
-rw-r--r-- | src/components/PollsList/RenderItem.tsx | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/components/PollsList/PollsList.tsx b/src/components/PollsList/PollsList.tsx index 3eeed2b..1ad7763 100644 --- a/src/components/PollsList/PollsList.tsx +++ b/src/components/PollsList/PollsList.tsx @@ -1,4 +1,4 @@ -import React, {useCallback, useState, useMemo, useRef, useEffect} from 'react'; +import React, { useCallback, useState, useMemo, useEffect } from 'react'; import { WindowScroller, AutoSizer, @@ -17,7 +17,7 @@ interface PropTypes { } const cache = new CellMeasurerCache({ - fixedWidth: true, + fixedWidth: true }); const PAGE_SIZE = 10; @@ -25,9 +25,9 @@ const PAGE_SIZE = 10; const PollsList: React.FC<PropTypes> = ({ polls, mutate }) => { const [displayCount, setDisplayCount] = useState<number>(PAGE_SIZE); - useEffect(()=> { + useEffect(() => { cache.clearAll(); - },[polls]); + }, [polls]); const rowRenderer = useCallback(({ index, style, key, parent }) => ( <RenderItem diff --git a/src/components/PollsList/RenderItem.tsx b/src/components/PollsList/RenderItem.tsx index fcac20c..6a99167 100644 --- a/src/components/PollsList/RenderItem.tsx +++ b/src/components/PollsList/RenderItem.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import { Poll } from 'which-types'; -import PollCard from '../PollCard/PollCard'; import { CellMeasurer, CellMeasurerCache, List } from 'react-virtualized'; +import PollCard from '../PollCard/PollCard'; interface PropTypes { @@ -43,7 +43,7 @@ const RenderItem: React.FC<PropTypes> = React.memo(({ rowIndex={index} parent={parent} > - <div key={`${_key}-${poll._id}`} style={{...style, paddingBottom: '20px' }}> + <div key={`${_key}-${poll._id}`} style={{ ...style, paddingBottom: '20px' }}> <PollCard poll={poll} setPoll={setPoll} /> </div> </CellMeasurer> |