codeant-ai-for-open-source[bot] commented on code in PR #38351:
URL: https://github.com/apache/superset/pull/38351#discussion_r2892494347


##########
superset-frontend/src/embedded/index.tsx:
##########
@@ -21,7 +21,9 @@ import 'src/public-path';
 import { lazy, Suspense } from 'react';
 import ReactDOM from 'react-dom';
 import { BrowserRouter as Router, Route } from 'react-router-dom';
-import { t } from '@apache-superset/core/translation';
+import { Global } from '@emotion/react';
+import { css } from '@apache-superset/core/ui';

Review Comment:
   **Suggestion:** The `css` helper is imported from 
`@apache-superset/core/ui`, which is intended for UI components and does not 
expose the Emotion `css` function; this will cause a module/type error or `css` 
to be undefined at runtime when used in `<Global styles={css`...`}>`. Import 
`css` from `@emotion/react` alongside `Global`, consistent with other global 
style usage in the codebase. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ Embedded frontend bundle fails to compile due to bad import.
   - ❌ Embedded dashboard iframe page cannot load for any user.
   - ⚠️ Global box-sizing fix for embedded dashboards never applies.
   ```
   </details>
   
   ```suggestion
   import { Global, css } from '@emotion/react';
   ```
   <details>
   <summary><b>Steps of Reproduction βœ… </b></summary>
   
   ```mdx
   1. Build or start the Superset frontend, which compiles
   `superset-frontend/src/embedded/index.tsx` as part of the embedded dashboard 
bundle (file
   confirmed via Read; imports at lines 24–25).
   
   2. During compilation, the bundler/TypeScript resolver attempts to resolve 
the import
   `import { css } from '@apache-superset/core/ui';` at
   `superset-frontend/src/embedded/index.tsx:25`.
   
   3. Our codebase search shows that `@apache-superset/core/ui` is only 
referenced here
   (Grep: pattern `from '@apache-superset/core/ui'` returns only this file) and 
that under
   `superset-frontend/packages` there is no `ui` subpath or index file (Glob 
for `**/ui.ts`,
   `**/ui/index.*`, and `**/ui/**/*` returned no matches), while other 
global-style usages
   (e.g. `packages/superset-core/src/theme/GlobalStyles.tsx:31`) import `css` 
directly from
   `@emotion/react`.
   
   4. Because the `@apache-superset/core` source tree in this repo does not 
define a `ui`
   subpath or any `css` re‑export, module resolution will fail with a "Cannot 
find module
   '@apache-superset/core/ui'" or missing export error, causing the embedded 
frontend build
   (and thus the embedded dashboard page) to fail until the import is corrected 
to `import {
   Global, css } from '@emotion/react';`.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/embedded/index.tsx
   **Line:** 24:25
   **Comment:**
        *Type Error: The `css` helper is imported from 
`@apache-superset/core/ui`, which is intended for UI components and does not 
expose the Emotion `css` function; this will cause a module/type error or `css` 
to be undefined at runtime when used in `<Global styles={css`...`}>`. Import 
`css` from `@emotion/react` alongside `Global`, consistent with other global 
style usage in the codebase.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38351&comment_hash=f2b5d7eee5fdfc87697576f2b842f09398773fc59f07d28e5cc8ff294e78e884&reaction=like'>πŸ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38351&comment_hash=f2b5d7eee5fdfc87697576f2b842f09398773fc59f07d28e5cc8ff294e78e884&reaction=dislike'>πŸ‘Ž</a>



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