korbit-ai[bot] commented on code in PR #33577:
URL: https://github.com/apache/superset/pull/33577#discussion_r2115089540
##########
superset-frontend/src/features/allEntities/AllEntitiesTable.tsx:
##########
@@ -106,8 +104,7 @@ export default function AllEntitiesTable({
tags={tags.filter(
(tag: Tag) =>
tag.type !== undefined &&
- ['TagType.custom', 1].includes(tag.type) &&
- tag.id !== tagId,
+ ['TagType.custom', 1].includes(tag.type),
)}
Review Comment:
### Invalid Tag Type Comparison <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The tag filtering logic includes a string literal 'TagType.custom' which
will never match any actual tag type values. This will cause custom tags to not
be displayed correctly.
###### Why this matters
The code is comparing an enum value with its string representation, which
will always fail the comparison and prevent custom tags from being shown in the
UI.
###### Suggested change ∙ *Feature Preview*
Replace the string enum comparison with the actual enum value:
```typescript
tags.filter(
(tag: Tag) =>
tag.type !== undefined &&
[TagType.custom, 1].includes(tag.type),
)
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7e7a4f13-d0b6-4c3f-bb01-860ec7f401fd/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7e7a4f13-d0b6-4c3f-bb01-860ec7f401fd?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7e7a4f13-d0b6-4c3f-bb01-860ec7f401fd?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7e7a4f13-d0b6-4c3f-bb01-860ec7f401fd?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7e7a4f13-d0b6-4c3f-bb01-860ec7f401fd)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:35466c1f-b163-4ebc-bc91-a6dec6501a46 -->
[](35466c1f-b163-4ebc-bc91-a6dec6501a46)
##########
superset/daos/tag.py:
##########
@@ -139,6 +136,13 @@ def find_by_name(name: str) -> Tag:
"""
return db.session.query(Tag).filter(Tag.name == name).first()
+ @staticmethod
+ def find_by_names(names: list[str]) -> list[Tag]:
+ """
+ returns tags by their names.
+ """
+ return db.session.query(Tag).filter(Tag.name.in_(names)).all()
Review Comment:
### Incomplete docstring for find_by_names <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The docstring is too brief and doesn't explain the behavior when tags aren't
found or names is empty.
###### Why this matters
Developers would need to read the code to understand edge cases, which
defeats the purpose of documentation.
###### Suggested change ∙ *Feature Preview*
"""Returns a list of Tag objects that match the provided names.
Args:
names: A list of tag names to search for.
Returns:
A list of found Tag objects. Tags that don't exist will be excluded from
the result.
Returns an empty list if names is empty.
"""
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b2c9fdf3-b0a6-4a7d-9fd5-15b3a27a2247/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b2c9fdf3-b0a6-4a7d-9fd5-15b3a27a2247?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b2c9fdf3-b0a6-4a7d-9fd5-15b3a27a2247?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b2c9fdf3-b0a6-4a7d-9fd5-15b3a27a2247?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b2c9fdf3-b0a6-4a7d-9fd5-15b3a27a2247)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:5631795c-bf3f-49e8-8f2a-6930fe3773e3 -->
[](5631795c-bf3f-49e8-8f2a-6930fe3773e3)
--
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]