diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 3 | ||||
-rw-r--r-- | src/components/PollsList/PollsList.tsx | 6 | ||||
-rw-r--r-- | src/components/PollsList/RenderItem.tsx | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index b6fdfaa..d909b79 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -44,7 +44,8 @@ const useStyles = makeStyles(theme => ({ transitionDuration: '0.5s' }, description: { - padding: '0px 16px 10px' + padding: '0px 16px 10px', + overflowWrap: 'break-word' } })); 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} diff --git a/src/components/PollsList/RenderItem.tsx b/src/components/PollsList/RenderItem.tsx index ce6f0c9..fcac20c 100644 --- a/src/components/PollsList/RenderItem.tsx +++ b/src/components/PollsList/RenderItem.tsx @@ -27,7 +27,6 @@ const RenderItem: React.FC<PropTypes> = React.memo(({ polls, mutate, index, style, cache, parent, _key }) => { const poll = polls[index]; - const setPoll = useCallback((newPoll: Poll) => { const newPolls = [...polls]; newPolls[index] = newPoll; @@ -44,7 +43,7 @@ const RenderItem: React.FC<PropTypes> = React.memo(({ rowIndex={index} parent={parent} > - <div key={`${_key}-${poll._id}`} style={{...style, paddingBottom: '40px' }}> + <div key={`${_key}-${poll._id}`} style={{...style, paddingBottom: '20px' }}> <PollCard poll={poll} setPoll={setPoll} /> </div> </CellMeasurer> |