2
0

🐛 (editor) inconsistency in route change auto save

This commit is contained in:
Baptiste Arnaud
2022-10-12 07:42:32 +02:00
parent d1cc9180c8
commit b46d35214d
4 changed files with 23 additions and 16 deletions

View File

@ -97,10 +97,16 @@ export const getAllResults = async (workspaceId: string, typebotId: string) => {
let lastResultId: string | undefined = undefined
do {
const query = stringify({ limit: 200, lastResultId, workspaceId })
const { data } = await sendRequest<{ results: ResultWithAnswers[] }>({
url: `/api/typebots/${typebotId}/results?${query}`,
method: 'GET',
})
const { data, error } = await sendRequest<{ results: ResultWithAnswers[] }>(
{
url: `/api/typebots/${typebotId}/results?${query}`,
method: 'GET',
}
)
if (error) {
console.error(error)
break
}
results.push(...(data?.results ?? []))
lastResultId = results[results.length - 1]?.id as string | undefined
if (data?.results.length === 0) hasMore = false