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/[email protected]/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/[email protected]/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 ?
10 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/[email protected]/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/[email protected]/dist/web.js)
Also I recommend using web.js
, not web.min.js
the file is already minified, no need to let jsdelivr do it