Hey there, I'm using the Visual Embed

Hey there, I'm using the Visual Embed SDK and React and embedding the list of dashboards using App Embed as follows:
const embed = new AppEmbed(`#my-div`, {
pageId: Page.Liveboards,
})
embed
.render()
.catch((error: Error) => {
// Embed has failed to load
})
return (<div id='my-div'></div>)
const embed = new AppEmbed(`#my-div`, {
pageId: Page.Liveboards,
})
embed
.render()
.catch((error: Error) => {
// Embed has failed to load
})
return (<div id='my-div'></div>)
Is the catch block enough to know the embed has failed to load for whatever reason? cc @Suvash
12 Replies
shikharTS
shikharTS2mo ago
I think it should work. @priyanshu.kumar can you comment here?
yuichirio_ha
yuichirio_ha2mo ago
Hi @rumana-hf , I would suggest EmbedEvent.Error to handle those, You can try the errors and check the same. We provide better ways as you check in the playground also the error banner is shown in the same way. https://developers.thoughtspot.com/docs/Class_AppEmbed#_on
AppEmbed
Embeds full ThoughtSpot experience in a host application.
Suvash
Suvash2mo ago
@yuichirio_ha how do you suggest we replicate the error from ThoughtSpot?
rumana-hf
rumana-hfOP2mo ago
Yes if you can provide some steps to 'cause' the error so that we can verify whether the EmbedEvent.Error is being handled correctly that would be great
shikharTS
shikharTS2mo ago
@jbc can you check on this?
jbc
jbc2mo ago
@rumana-hf @Suvash Yes, for a sample you can give a incorrect liveboardId to LiveboardEmbed and check for an error Or in the case of AppEmbed:
const embed = new AppEmbed(`#my-div`, {
pageId: Page.Liveboards,
path: 'insights/pinboard/795de2ca', //incorrect liveboardId
})
embed
.on(EmbedEvent.Error, e => console.log('Embed Error: ', e))
.render()
const embed = new AppEmbed(`#my-div`, {
pageId: Page.Liveboards,
path: 'insights/pinboard/795de2ca', //incorrect liveboardId
})
embed
.on(EmbedEvent.Error, e => console.log('Embed Error: ', e))
.render()
rumana-hf
rumana-hfOP3w ago
Hi there @jbc I tried this and it worked but it errors out with any error for eg.the query fails when I input the wrong paramteres while searching data etc. I wany to display a custom Loading error page only if the embed fails in the first render Is there a way to check Embed rendering failured when it first loads
jbc
jbc3w ago
@rumana-hf Yes, this event listener triggers on every error. Can I know what kind of failure of first render you are talking about? Most of the time within the product, if there are errors they block the whole page.
rumana-hf
rumana-hfOP3w ago
Right now if there is any error, I show my custom Error page which is not helpful. For example while searching data I might get a Query Execution Failed. It looks fine in Thoughspot but when I embed the content, I don't want the entire screen to show the custom error page.
No description
rumana-hf
rumana-hfOP3w ago
I only want to know if there any error when the component is first rendered. After the render is complete, I would rather use the Thoughtspot error messages like "Query Execution Failed' because displaying a custom error page at this stage results in a poor customer experience
shikharTS
shikharTS3w ago
@Justin Mathew can you help here?
Justin Mathew
Justin Mathew3w ago
@rumana-hf can you give an example of an error which happend on first render ? so we will expose events for those if not there or is exsiting we can point you to it (this might require a feature request)

Did you find this page helpful?