codeant-ai-for-open-source[bot] commented on code in PR #37298:
URL: https://github.com/apache/superset/pull/37298#discussion_r2710427076
##########
superset-frontend/src/SqlLab/components/SqlEditorTopBar/index.tsx:
##########
@@ -16,12 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Divider, Flex } from '@superset-ui/core/components';
-import { styled } from '@apache-superset/core/ui';
+import { Divider, EmptyState, Flex } from '@superset-ui/core/components';
+import { css, styled } from '@apache-superset/core/ui';
Review Comment:
**Suggestion:** The `css` template tag is imported from
`@apache-superset/core/ui`, but that package may not export a `css` template
function (the project normally sources the Emotion `css` from
`@emotion/react`). If `css` is undefined at runtime the `css\`...\`` call will
throw. Import `css` from `@emotion/react` (and keep `styled` from the current
UI package) to ensure the template tag exists. [possible bug]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ SqlEditorTopBar fails to render in SQLLab.
- ❌ DatabaseSelector modal inaccessible from top bar.
- ⚠️ Primary/secondary menu actions hidden.
```
</details>
```suggestion
import { styled } from '@apache-superset/core/ui';
import { css } from '@emotion/react';
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Build and run the frontend with the PR changes so the SQL editor loads.
The component
file to exercise is
superset-frontend/src/SqlLab/components/SqlEditorTopBar/index.tsx.
2. Navigate to SQLLab so React mounts SqlEditorTopBar (the default export
from the file
above). The component renders the JSX block that uses the `css` template tag
at the Flex
prop (see the same file where css is used at the block starting around the
`css\`` usage).
3. At render time the expression css`min-width: 0; overflow: hidden;` (in
this file) is
evaluated; if `css` imported from '@apache-superset/core/ui' is undefined,
React will
throw TypeError: css is not a function when evaluating the template tag.
4. Observed failure: SQL editor top bar fails to render and a runtime error
appears in the
browser console referencing
superset-frontend/src/SqlLab/components/SqlEditorTopBar/index.tsx (the
`css\`` usage
site).
Explanation: the project package `@apache-superset/core/ui` (see
packages/superset-core/src/ui/theme exports) does not export `css` in
this codebase;
keeping `css` imported from there is likely incorrect. Replacing the
import with `css`
from '@emotion/react' matches how template tags are provided in other
code.
```
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/components/SqlEditorTopBar/index.tsx
**Line:** 20:20
**Comment:**
*Possible Bug: The `css` template tag is imported from
`@apache-superset/core/ui`, but that package may not export a `css` template
function (the project normally sources the Emotion `css` from
`@emotion/react`). If `css` is undefined at runtime the `css\`...\`` call will
throw. Import `css` from `@emotion/react` (and keep `styled` from the current
UI package) to ensure the template tag exists.
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>
--
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]