codeant-ai-for-open-source[bot] commented on code in PR #35754:
URL: https://github.com/apache/superset/pull/35754#discussion_r3672429722
##########
superset-frontend/src/embedded/api.tsx:
##########
@@ -83,6 +86,14 @@ const getActiveTabs = () =>
store?.getState()?.dashboardState?.activeTabs || [];
const getDataMask = () => store?.getState()?.dataMask || {};
+const setDataMask = ({ dataMask }: { dataMask: DataMaskStateWithId }) => {
+ batch(() => {
+ Object.entries(dataMask).forEach(([filterId, mask]) => {
+ store?.dispatch(updateDataMask(filterId, mask));
+ });
Review Comment:
**Suggestion:** The method only dispatches updates for entries present in
the new object, while the public `setDataMask` API accepts a complete mask.
Filters omitted from a later call remain in Redux, and calling
`setDataMask({})` leaves all existing filters active instead of clearing or
replacing the current mask. Replace the state atomically or explicitly
remove/reset filters absent from the supplied mask. [api mismatch]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Filters omitted from later calls remain applied.
- ❌ Empty masks cannot clear embedded dashboard filters.
- ⚠️ `getDataMask` returns stale omitted filter entries.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5042783ff8804747b9dd8b4139294205&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5042783ff8804747b9dd8b4139294205&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/embedded/api.tsx
**Line:** 91:93
**Comment:**
*Api Mismatch: The method only dispatches updates for entries present
in the new object, while the public `setDataMask` API accepts a complete mask.
Filters omitted from a later call remain in Redux, and calling
`setDataMask({})` leaves all existing filters active instead of clearing or
replacing the current mask. Replace the state atomically or explicitly
remove/reset filters absent from the supplied mask.
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.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F35754&comment_hash=8601becf8b57259520449d36a6e2027f4d113fc5df19a0df53b705a52d4a7b75&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F35754&comment_hash=8601becf8b57259520449d36a6e2027f4d113fc5df19a0df53b705a52d4a7b75&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]