David - Hi, My thoughtspot dashboard is embedde...
Hi, My thoughtspot dashboard is embedded in my webapp using react. The problem is that it sends duplicate queries to snowflake.
9 Replies
That should not be the case, is this happening when you open the dashboard in the ThoughtSpot app as well?
No, only embedded.
Gemini says I need to enclose in useEffect. Does that sound correct?
// STEP 2: Wrap the initialization logic in a useEffect hook
useEffect(() => {
// We only want to run init() if we have a user, otherwise it might fail.
// The component will re-render when
user
becomes available, but the
// init() will have already run or been skipped.
if (user && user.org_name) {
console.log("Initializing ThoughtSpot SDK... (This should appear only once)");
init({
thoughtSpotHost: 'https://daisee-au.thoughtspot.cloud',
authType: AuthType.TrustedAuthTokenCookieless,
username: ${user.email}@${user.org_name}
,
});
}
}, [user, getAccessTokenSilently]); // <--- STEP 3: Add a dependency array.This init happens before any data call to snowflake happens. This won't help..
What are other possible causes?
It usually happens when you are embedding the same liveboard multiple times. How are you seeing multiple duplicate queries in snowflake? are you rendering the liveboard again? Are you using any data calls?
@shikharTS Which code snipet and segment should I check?
I think it would be the liveboard embed.
It might be difficult to debug this without artifacts (code, har files, the behaviour on TS app). We might need to get on a call with you, I would recommend to go through the support case to get this resolved.
I've already had a call with support and was referred here.
I've attached the network log for the embedded and TS dashboards. Same Liveboard with 3 charts. 3 messages in TS but 6 embedded.
I've also attached the embedding code. Can you see anything wrong?





Does not look like anything is wrong..