@@ -30,6 +30,8 @@ export const SupersetReport = ({
3030} ) => {
3131 const containerRef = useRef ( null ) ;
3232 const tokenRef = useRef ( null ) ;
33+ const previousUiConfigRef = useRef ( null ) ;
34+
3335 const [ isEmbedded , setIsEmbedded ] = useState ( false ) ;
3436 const [ dashboard , setDashboard ] = useState ( null ) ;
3537
@@ -45,15 +47,19 @@ export const SupersetReport = ({
4547 if ( ! report ?. id || ! options ?. supersetUrl ) return ;
4648
4749 const loadSuperset = async ( ) => {
48- if ( isEmbedded || guestToken ?. status !== SUPERSET_GUEST_TOKEN_STATUS . SUCCESS ) return ;
50+ if ( guestToken ?. status !== SUPERSET_GUEST_TOKEN_STATUS . SUCCESS ) return ;
51+
52+ const forceRefresh = JSON . stringify ( report ?. uiConfig ) !== JSON . stringify ( previousUiConfigRef . current ) ;
53+ if ( isEmbedded && ! forceRefresh ) return ;
4954
55+ previousUiConfigRef . current = report ?. uiConfig ;
5056 try {
5157 const embedded = await embedDashboard ( {
5258 id : report . id ,
5359 supersetDomain : options . supersetUrl ,
5460 mountPoint : containerRef . current ,
5561 fetchGuestToken : async ( ) => tokenRef . current ,
56- dashboardUiConfig : report ?. uiConfig || { } ,
62+ dashboardUiConfig : report ?. uiConfig ?? { } ,
5763 } ) ;
5864 setDashboard ( embedded ) ;
5965 setIsEmbedded ( true ) ;
@@ -73,7 +79,7 @@ export const SupersetReport = ({
7379 if ( dashboard ?. destroy ) dashboard . destroy ( ) ;
7480 } ;
7581 // eslint-disable-next-line react-hooks/exhaustive-deps
76- } , [ report . id , options . supersetUrl , guestToken ] ) ;
82+ } , [ isEmbedded , report ? .id , report ?. uiConfig , options . supersetUrl , guestToken ] ) ;
7783
7884 const { placeholder, showPlaceholder } = useMemo ( ( ) => {
7985 const scenarioDTO = PowerBIUtils . constructScenarioDTO ( scenario , visibleScenarios ) ;
0 commit comments