Skip to content

Commit

Permalink
fix(results): crash when variable is object
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Aug 22, 2022
1 parent 5928142 commit 02bb7f5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 0 additions & 3 deletions apps/builder/components/results/ResultsTable/ResultsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ export const ResultsTable = ({
[resultHeader]
)

// TO-DO: remove. Meant to help me investigate why table crash in some specific circumstances.
console.log(data)

const instance = useReactTable({
data,
columns,
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/services/typebots/results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const convertResultsToTableData = (
if (isDefined(o[key])) return o
return {
...o,
[key]: { plainText: variable.value },
[key]: { plainText: variable.value?.toString() },
}
}, {}),
}))
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-engine/src/contexts/TypebotContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const typebotContext = createContext<{
linkedBotQueue: LinkedTypebotQueue
isLoading: boolean
setCurrentTypebotId: (id: string) => void
updateVariableValue: (variableId: string, value: string) => void
updateVariableValue: (variableId: string, value: string | number) => void
createEdge: (edge: Edge) => void
injectLinkedTypebot: (typebot: Typebot | PublicTypebot) => LinkedTypebot
popEdgeIdFromLinkedTypebotQueue: () => void
Expand Down
9 changes: 7 additions & 2 deletions packages/bot-engine/src/services/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type IntegrationContext = {
groups: Group[]
resultId?: string
updateVariables: (variables: VariableWithValue[]) => void
updateVariableValue: (variableId: string, value: string) => void
updateVariableValue: (variableId: string, value: string | number) => void
onNewLog: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
}

Expand Down Expand Up @@ -263,7 +263,12 @@ const executeWebhook = async (
)
try {
const value = func(data)
updateVariableValue(existingVariable?.id, value)
updateVariableValue(
existingVariable?.id,
typeof value !== 'number' && typeof value !== 'string'
? JSON.stringify(value)
: value
)
return [...newVariables, { ...existingVariable, value }]
} catch (err) {
return newVariables
Expand Down

5 comments on commit 02bb7f5

@vercel
Copy link

@vercel vercel bot commented on 02bb7f5 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 02bb7f5 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs.typebot.io
docs-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 02bb7f5 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 02bb7f5 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 02bb7f5 Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2-alpha – ./apps/viewer

yobot.me
ns8.vn
8jours.top
vhpage.cr8.ai
finplex.be
247987.com
bt.id8rs.com
bot.aipr.kr
sat.cr8.ai
bot.aws.bj
an.nigerias.io
ar.nigerias.io
am.nigerias.io
bot.lalmon.com
apr.nigerias.io
ticketfute.com
aso.nigerias.io
apo.nigerias.io
bot.ageenda.com
bot.artiweb.app
chat.sureb4.com
bot.tc-mail.com
games.klujo.com
eventhub.com.au
sakuranembro.it
typebot.aloe.do
bot.piccinato.co
botc.ceox.com.br
bot.upfunnel.art
clo.closeer.work
faqs.nigerias.io
feedback.ofx.one
kw.wpwakanda.com
form.syncwin.com
bot.maitempah.com
bot.agfunnel.tech
typebot.aloe.bot
stan.vselise.com
voicehelp.cr8.ai
app.chatforms.net
bot.phuonghub.com
bot.reviewzer.com
cares.urlabout.me
k1.kandabrand.com
gentleman-shop.fr
fmm.wpwakanda.com
1988.bouclidom.com
ov3.wpwakanda.com
ov2.wpwakanda.com
ov1.wpwakanda.com
lb.ticketfute.com
andreimayer.com.br
bot.megafox.com.br
bot.neferlopez.com
dicanatural.online
goalsettingbot.com
this-is-a-test.com
bot.digitalbled.com
bot.eventhub.com.au
zap.techadviser.in
survey.digienge.io
carsalesenquiry.com
forms.webisharp.com
order.maitempah.com
quest.wpwakanda.com
typebot.stillio.com
bium.gratirabbit.com
bot.ansuraniphone.my
chat.hayurihijab.com
bot.cotemeuplano.com
click.sevenoways.com
get.freebotoffer.xyz
connect.growthguy.in
abutton.wpwakanda.com
aidigitalmarketing.kr
bbutton.wpwakanda.com
bot.meuesocial.com.br
chat.missarkansas.org
cdd.searchcube.com.sg
bot.ramonmatos.com.br
bot.incusservices.com
apply.ansuraniphone.my
sbutton.wpwakanda.com
bbutton.wpwwakanda.com
c23111azqw.nigerias.io
felipewelington.com.br
gcase.barrettamario.it
form.searchcube.com.sg
report.gratirabbit.com
kodawariab736.skeep.it
info.clickasuransi.com
view.onlinebotdemo.xyz
resume.gratirabbit.com
83242573.actualizar.xyz
bot.blackboxtips.com.br
bot.upgradesolutions.eu
signup.hypemarketing.in
mainmenu.diddancing.com
91181264.your-access.one
hunterbot.saleshunter.ai

Please sign in to comment.