villebro commented on code in PR #20259:
URL: https://github.com/apache/superset/pull/20259#discussion_r966983185


##########
superset-embedded-sdk/src/index.ts:
##########
@@ -99,6 +102,9 @@ export async function embedDashboard({
     return new Promise(resolve => {
       const iframe = document.createElement('iframe');
       const dashboardConfig = dashboardUiConfig ? 
`?uiConfig=${calculateConfig()}` : ""
+      const queryParams = queryParameters ?
+        (dashboardConfig === "" ? "?" : "&") + new 
URLSearchParams(queryParameters).toString() :
+        ""

Review Comment:
   nit: this feels slightly hacky. Could we perhaps create a new object 
`allQueryParams` like this:
   
   ```javascript
   const allQueryParams = {...queryParameters}
   if (dashboardUiConfig) {
       allQueryParams['uiConfig'] = calculateConfig();
   }
   ```
   and then just do 
   
   ```javascript
   iframe.src = `${supersetDomain}/embedded/${id}{new 
URLSearchParams(allQueryParams).toString()}`;
   ```
   
   (note: I didn't test this, so consider this javascript-y pseudocode)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to