korbit-ai[bot] commented on code in PR #31331:
URL: https://github.com/apache/superset/pull/31331#discussion_r1894153156
##########
superset-embedded-sdk/src/index.ts:
##########
@@ -71,11 +71,12 @@ export type Size = {
}
export type EmbeddedDashboard = {
- getScrollSize: () => Promise<Size>
- unmount: () => void
- getDashboardPermalink: (anchor: string) => Promise<string>
- getActiveTabs: () => Promise<string[]>
-}
+ getScrollSize: () => Promise<Size>;
+ unmount: () => void;
+ getDashboardPermalink: (anchor: string) => Promise<string>;
+ getActiveTabs: () => Promise<string[]>;
+ getDataMasks: (callbackFn: (dataMasks: any[]) => void) => void;
Review Comment:
### Missing Unsubscribe Mechanism <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The getDataMasks function doesn't provide a way to unsubscribe from data
mask events, which could lead to memory leaks.
###### Why this matters
Without an unsubscribe mechanism, callbacks will continue to be called even
if the component using them is unmounted, potentially causing memory leaks and
unexpected behavior.
###### Suggested change
Return an unsubscribe function: getDataMasks: (callbackFn: (dataMasks:
DataMask[]) => void) => () => void;
</details>
###### Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help
Korbit improve your reviews.
<!--- korbi internal id:73e48f5d-f702-4ae3-a1a9-8d79c75ca9e3 -->
--
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]