@@ -7,7 +7,7 @@ import { Image, Box, Collapse, Tag, TagLabel, TagLeftIcon, Button } from "@chakr
77import { useSelector } from 'react-redux'
88import { RootState } from '../../state/store'
99import { renderString } from '../../helpers/templatize'
10- import { getOrigin } from '../../helpers/origin'
10+ import { getOrigin , getParsedIframeInfo } from '../../helpers/origin'
1111import { getApp } from '../../helpers/app'
1212import { processSQLWithCtesOrModels } from '../../helpers/catalogAsModels'
1313import { getAllTemplateTagsInQuery , replaceLLMFriendlyIdentifiersInSqlWithModels } from 'apps'
@@ -170,6 +170,7 @@ function ImageComponent(props: any) {
170170function generateMetabaseQuestionURL ( sql : string , databaseId : number | null = null , embedConfigs : EmbedConfigs = { } ) {
171171 // Get Metabase origin from embed_configs if available, otherwise use iframe info
172172 const templateTags = getAllTemplateTagsInQuery ( sql ) ;
173+ const isEmbedded = getParsedIframeInfo ( ) . isEmbedded as unknown === 'true'
173174
174175 // Get all template tags in the query (we don't have access to snippets here, so pass undefined)
175176 const cardData = {
@@ -189,7 +190,7 @@ function generateMetabaseQuestionURL(sql: string, databaseId: number | null = nu
189190
190191 const hash = btoa ( JSON . stringify ( cardData ) ) ;
191192 const origin = embedConfigs . embed_host ;
192- if ( ! origin ) {
193+ if ( ! origin || ! isEmbedded ) {
193194 return `${ getOrigin ( ) } /question#${ hash } ` ;
194195 }
195196 return `${ origin } /question?hash=${ hash } ` ;
0 commit comments