dosubot[bot] commented on issue #37310: URL: https://github.com/apache/superset/issues/37310#issuecomment-3780932256
<!-- Greeting --> Hi @YuriyKrasilnikov! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> The root cause is confirmed: embedded dashboards don't call `initFeatureFlags()`, so `window.featureFlags` stays undefined and triggers the "Failed to query feature flag" errors. This is a known issue and matches your analysis. The fix is to add `initFeatureFlags(bootstrapData.common.feature_flags)` right after you call `getBootstrapData()` in `superset-frontend/src/embedded/index.tsx`, just like it's done in `preamble.ts` for regular dashboards. This will initialize feature flags in embedded mode and stop the console errors. There are no known side effects—this approach is safe and aligns with how feature flags are set up elsewhere in Superset. You can see this confirmed and discussed in [this GitHub issue](https://github.com/apache/superset/issues/33702). **How to fix:** 1. Import `initFeatureFlags` at the top of `embedded/index.tsx` if it's not already imported. 2. After `const bootstrapData = getBootstrapData();`, add: ```typescript initFeatureFlags(bootstrapData.common.feature_flags); ``` 3. Save and rebuild your frontend. This will resolve the feature flag errors in embedded dashboards. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f406ec4e-b7d1-459d-b3b1-4fb5f8083ac8?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20root%20cause%20is%20confirmed%3A%20embedded%20dashboards%20don%27t%20call%20%60initFeatureFlags%28%29%60%2C%20so%20%60window.featureFlags%60%20stays%20undefined%20and%20triggers%20the%20%22Failed%20to%20query%20feature%20flag%22%20errors.%20This%20is%20a%20known%20issue%20and%20matches%20your%20analysis.%20The%20fix%20is%20to%20add%20%60initFeatureFlags%28bootstrapData.common.feature_flags%29%60%20right%20after%20you%20call%20%60getBootstrapData%28%29%60%20in%20%60superset-frontend/src/embedded/index.tsx%60%2C%20just%20like%20it%27s%20done%20in%20%60preamble.ts%60%20for%20regular%20dashboards.%20This%20will%20initialize%20feature%20flags%20in%20embedded%20mode%20and%20stop%20the%20console%20errors.%20There%20are%20no%20known%20side%20effects% E2%80%94this%20approach%20is%20safe%20and%20aligns%20with%20how%20feature%20flags%20are%20set%20up%20elsewhere%20in%20Superset.%0A%0AYou%20can%20see%20this%20confirmed%20and%20discussed%20in%20%5Bthis%20GitHub%20issue%5D%28https%3A//github.com/apache/superset/issues/33702%29.%0A%0A%2A%2AHow%20to%20fix%3A%2A%2A%0A1.%20Import%20%60initFeatureFlags%60%20at%20the%20top%20of%20%60embedded/index.tsx%60%20if%20it%27s%20not%20already%20imported.%0A2.%20After%20%60const%20bootstrapData%20%3D%20getBootstrapData%28%29%3B%60%2C%20add%3A%0A%20%20%20%60%60%60typescript%0A%20%20%20initFeatureFlags%28bootstrapData.common.feature_flags%29%3B%0A%20%20%20%60%60%60%0A3.%20Save%20and%20rebuild%20your%20frontend.%0A%0AThis%20will%20resolve%20the%20feature%20flag%20errors%20in%20embedded%20dashboards.) [](https://go.dosu.dev/discord-bot) [](https:/ /twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37310) -- 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]
