Blank after reinitialisation
I have weird behaviour, when i try to open the same typebot twice in my code (Vue.js) , the second time, the buttons are not rendered.
... This is somehow weird to me. I am trying to resolve it half the day, but unsuccessfull ... Based on my conversation with chatgpt, i initialise chatbot like this export function initializeTypebot( botUrl, woundUrl, prefilledVariables = {}, id,visitorId) { if (!promise) { promise = import('https://cdn.jsdelivr.net/npm/@typebot.io/js@0.3.78/dist/web.js'); } return promise.then(({ default: Typebot }) => { const typebotInstance = markRaw(Typebot); typebotInstance.unmount(); typebotInstance.initStandard({ sessionId: id, visitorId,
typebot: woundUrl, apiHost: botUrl, prefilledVariables, rememberUser: false });
console.log('Typebot instance initialized:', typebotInstance); return typebotInstance; }) .catch(err => { console.error(err); throw err; }); } always with different id, however the bad rendering persist... Anyone had similar problem ?
... This is somehow weird to me. I am trying to resolve it half the day, but unsuccessfull ... Based on my conversation with chatgpt, i initialise chatbot like this export function initializeTypebot( botUrl, woundUrl, prefilledVariables = {}, id,visitorId) { if (!promise) { promise = import('https://cdn.jsdelivr.net/npm/@typebot.io/js@0.3.78/dist/web.js'); } return promise.then(({ default: Typebot }) => { const typebotInstance = markRaw(Typebot); typebotInstance.unmount(); typebotInstance.initStandard({ sessionId: id, visitorId,
typebot: woundUrl, apiHost: botUrl, prefilledVariables, rememberUser: false });
console.log('Typebot instance initialized:', typebotInstance); return typebotInstance; }) .catch(err => { console.error(err); throw err; }); } always with different id, however the bad rendering persist... Anyone had similar problem ?
22 Replies
so I made a video showcasing this issue : https://vimeo.com/1085209082?share=copy
Pavol Martiš
Vimeo
Typebot error reinitialisation
This is "Typebot error reinitialisation" by Pavol Martiš on Vimeo, the home for high quality videos and the people who love them.
there seems to be an issue, that unmount() does not work properly, so that the next initialisation remembers some of the old state ? I try hard to work some way around, but I fail miserably
I pinpointed it even further... The problem is when clicking on a back button, i execute command "goBack", the typebot then runs the script block with
window.dispatchEvent(new CustomEvent("typebot-abort")); ... this then sends the signal to close the typebot... The problem is somewhere in the execution of this dispatching event in the typebot. because if I just run the same event in the application, it works fine, but executing it within typebot, it gives this result
I'm sorry it's tough to understand the issue like this. Can you boil it down to:
1. How to reproduce it
2. What you expected
Would be great if you have a Github repo that reproduces the issue so that I try on my end
Hi Baptiste, I have recreated a repo here with only one script and typebot loading here https://github.com/stanlay01/typebot-error with a bot https://typebot.prixi.sk/typebots/cmav3cftb00272qamjp9etnnp/edit . I have two problems: On "back button" command I want to reload typebot, but after reloading it hides buttons (I want normal reload). Second One is that the back button stops working after I send http request from the typebot. I can explain it to you on a call, if you want https://cal.com/info-prixi/secret?overlayCalendar=true
GitHub
GitHub - stanlay01/typebot-error
Contribute to stanlay01/typebot-error development by creating an account on GitHub.
Editor
Create and publish conversational forms that collect 4 times more answers and feel native to your product
Thanks for the reproduction, trying now
unmount is actually not a usable command, it's only used internal for the Bubble embed
Would be nice indeed to have a
reload
command
OK so what happens in your example: the command is received by Typebot, it triggers the Script block, which dispatch an event, then the flow stops because you didn't add a https://docs.typebot.io/editor/blocks/logic/return#return
The event for some reason is not received by your app.Hmm, looks like adding the return command helps with the first problem. What about the second one ? Return block didn't help there. I tried it locally, on server I do not have yet updated version of typebot with return block. But once I send http request, command stops working ... why ? https://typebot.prixi.sk/typebots/cmav3cftb00272qamjp9etnnp/edit
Editor
Create and publish conversational forms that collect 4 times more answers and feel native to your product
Well... not even with the first problem. it only put back on the flow of my typebot, but what I really need is reload of a typebot... Yeah, for that reload() would be great... or some tutorial, how to reload if possible.
Well now you don't have any event emitted on your command flow so I am not sure what you are expecting here! Even if we have the reload command it won't be triggered in your case
Let me try the second problem
Indeed it seems there's a bug here. Let me debug that
Alright, fixed on embed lib v0.3.92 (deploying now)
is it this version https://cdn.jsdelivr.net/npm/@typebot.io/js@0.3.92/dist/web.min.js ? It does not load the bot for me
Works for me on your reproduction and just changing the url version 🤔
Just shipped a new
reload
command on v0.6.0 (https://cdn.jsdelivr.net/npm/@typebot.io/js@0.6/dist/web.js)
Also I recommend using web.js
, not web.min.js
the file is already minified, no need to let jsdelivr do itGreat ! Thanks you very much ... Just One more thing, in v0.6.0 there is a leftover after sending http request ,the button change to http response {"statusCode":200,"data":{"origin":"91.127.42.56"}}
Oh, it is getting better. Now I am testing it more in depth, but the issue with sending http requests is somehow deeper. With some requests it is now working, but with others it is not. I have no idea why. Seems like if something triggers some warning inside typebot and command stops working. For example I figured out that setting empty variables also stops the execution of the command. But that is easy to figure out.
what would maybe help is some piece of code, that I would put in script block that would restart the command to work , so that I could put in my workflow in critical points
Please provide new reproduction with a clear description on how to reproduce the bug 🙂
Test this now ... https://typebot.prixi.sk/typebots/cmav3cftb00272qamjp9etnnp/edit ... I have no idea what is the difference between button one and button two other than one text bubble before http
Editor
Create and publish conversational forms that collect 4 times more answers and feel native to your product
with the html here https://github.com/stanlay01/typebot-error/blob/main/index.html
GitHub
typebot-error/index.html at main · stanlay01/typebot-error
Contribute to stanlay01/typebot-error development by creating an account on GitHub.
Checking now
Indeed a bug was introduced in this embed lib version
Fixing it now
Fixed in v0.7.3
I suggest you change your import URL to
https://cdn.jsdelivr.net/npm/@typebot.io/js@0/dist/web.js
to automatically get latest minor updatesThank you 🙂 ... I still have some issue, but I have problem reproducing it in simple bot. I will let you know, when I have figured it out
Feel free, thanks for the bug reports 🙂
finally was able to isolate the issue ... here https://typebot.prixi.sk/typebots/cmav3cftb00272qamjp9etnnp/edit the variable setup "patient" somehow breaks the command ... if you just remove the variable setup command works
Editor
Create and publish conversational forms that collect 4 times more answers and feel native to your product

Can you update the reproduction repo and provide clear instructions?
yes, I have updated the repo... the error is clear : command works without "patient" variable in Group #1, with patient variable, command is not working ...
Any update please ?
Checking now
Well it will most likely be fixed in next monthly release 🙏
I'm pushing a new
next
release if you need to try it soonerGitHub
🐛 Always transform undefined to null values for user name and im...
💬 Typebot is a powerful chatbot builder that you can self-host. - 🐛 Always transform undefined to null values for user name and image i… · baptisteArno/typebot.io@b8d5899