handreyrc commented on PR #2164: URL: https://github.com/apache/incubator-kie-tools/pull/2164#issuecomment-1992689156
> @handreyrc Glad to hear it worked! No, you're definitely right, my point with unsubscribing right away was for the case where you would just look at the value once, but for this particular use case, indeed we need a "permanent" subscription that will alter the theme on the Editor every time is changes on the Shared Value. Well done! > > One thing I would do, though, is trying to find where would it be a good place to put the unsubscription. Maybe on the "componentDidUnmount" (or the returned lambda of an `useEffect` without dependencies) of the `EditorEnvelopeView` component? Hey @tiagobento, We tested your idea of implemening the unsubscribe in a returned lambda of an useEffect without dependencies of the EditorEnvelopeView or some other place. Turns out that after further investigation those hooks are never called. In our tests the whole editor iFame is dropped before those lifecycle hooks have a chance to be executed. Looking at this context its not very likely that we are introducing a memory leak by not unsubscribing that shared value. On top of that there are other implications in making that subscription in other places such as random nullpointers when the setTheme is called and the GWT Editor is not completely initialized. Please, take a look at my latest. WDYT? BTW, Thanks a lot @paulovmr for the helping hand. -- 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]
