Skip to content

Commit

Permalink
Merge pull request #740 from StampyAI/ticket-#717
Browse files Browse the repository at this point in the history
fix: article suggestions refresh when user clicks settings #717
  • Loading branch information
zarSou9 authored Jun 21, 2024
2 parents 45595cf + 30a01b2 commit 7baa4ee
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions app/components/Chatbot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,20 @@ type FollowupsProps = {
}
const Followups = ({title, followups, onSelect, className}: FollowupsProps) => {
const {randomQuestions} = useOnSiteQuestions()
const items =
(followups?.length || 0) >= 3
? followups
: [
...(followups || []),
...randomQuestions().map(({title, pageid}) => ({text: title, pageid})),
].slice(0, 3)
const [items, setItems] = useState(followups)

useEffect(() => {
const initialItems =
(followups?.length || 0) >= 3
? followups
: [
...(followups || []),
...randomQuestions().map(({title, pageid}) => ({text: title, pageid})),
].slice(0, 3)

setItems(initialItems)
// eslint-disable-next-line
}, [followups])
return (
<>
{title && <div className={'padding-bottom-24' + (className || '')}>{title}</div>}
Expand Down

0 comments on commit 7baa4ee

Please sign in to comment.