2
0

⚗️ Add infinite scroll in results table

This commit is contained in:
Baptiste Arnaud
2022-01-04 12:25:48 +01:00
parent 8ddf608c9e
commit 72454c0f68
9 changed files with 200 additions and 98 deletions

View File

@ -19,10 +19,18 @@ export const ResultsContent = () => {
status: 'error',
})
const { stats } = useStats({
const { stats, mutate } = useStats({
typebotId: typebot?.id,
onError: (err) => toast({ title: err.name, description: err.message }),
})
const handleDeletedResults = (total: number) => {
if (!stats) return
mutate({
stats: { ...stats, totalStarts: stats.totalStarts - total },
})
}
return (
<Flex h="full" w="full">
<Flex
@ -66,6 +74,7 @@ export const ResultsContent = () => {
) : (
<SubmissionsContent
typebotId={typebot.id}
onDeleteResults={handleDeletedResults}
totalResults={stats?.totalStarts ?? 0}
/>
))}