YuriyKrasilnikov opened a new issue, #37310:
URL: https://github.com/apache/superset/issues/37310

   ### Bug description
   
   When using embedded dashboards with guest tokens, the browser console shows 
multiple errors:
   
   ```
   Failed to query feature flag ENABLE_JAVASCRIPT_CONTROLS
   ```
   
   **Root cause:** The `embedded/index.tsx` entry point does not call 
`initFeatureFlags()`, so `window.featureFlags` remains `undefined`. When 
`isFeatureEnabled()` is called, it throws an error trying to access a property 
on `undefined`.
   
   **In regular mode** (`preamble.ts:81`):
   ```typescript
   initFeatureFlags(bootstrapData.common.feature_flags);
   ```
   
   **In embedded mode** (`embedded/index.tsx`): No initialization of feature 
flags.
   
   **Steps to reproduce:**
   1. Create an embedded dashboard with guest token
   2. Open the embedded dashboard in an iframe
   3. Open browser console (F12)
   4. See multiple "Failed to query feature flag" errors
   
   **Expected behavior:**
   No console errors. Feature flags should be initialized from bootstrap data 
in embedded mode.
   
   **Suggested fix:**
   Add `initFeatureFlags(bootstrapData.common.feature_flags)` to 
`embedded/index.tsx` after `getBootstrapData()`, similar to `preamble.ts`.
   
   ### Screenshots/recordings
   
   N/A - console errors are text-based
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   3.12
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   Feature flags enabled:
   - `EMBEDDED_SUPERSET: true`
   - `EMBEDDABLE_CHARTS: true`
   
   The errors do not break functionality but clutter the console and may 
confuse developers debugging embedded dashboards.
   
   Related code locations:
   - `superset-frontend/src/embedded/index.tsx` - missing initialization
   - `superset-frontend/src/preamble.ts:81` - correct initialization
   - 
`superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts:106` - 
where error is logged
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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